-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable warnings by default #271
Comments
For the record, at the moment I'm using this as a workaround in my own unit tests: import warnings
import unittesting
class SublimeTestCase(unittesting.DeferrableTestCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
warnings.simplefilter("error") # for this process
os.environ["PYTHONWARNINGS"] = "default" # also for subprocesses
@classmethod
def tearDownClass(cls):
warnings.resetwarnings()
del os.environ["PYTHONWARNINGS"]
super().tearDownClass() |
OK, this was easier than anticipated. Here's a PR (my second in this repo =)) which adds a new "warnings" settings: |
Fixed by #272 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Python unittest module automatically enables warnings before starting the test suite:
UnitTesting package should do the same. This is important especially for
ResourceWarning
s. E.g. with warnings enabled the code below:...will print a warning like this in the console:
Official Python doc states https://docs.python.org/3/library/warnings.html#overriding-the-default-filter:
The text was updated successfully, but these errors were encountered: