diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2017-11-27 11:11:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-27 11:11:55 (GMT) |
commit | 21c7730761e2a768e33b89b063a095d007dcfd2c (patch) | |
tree | 1d96b9b8c87ed00337e15d2a8c1f287fac4ffcb1 /Lib/test/test_cmd_line.py | |
parent | c172fc5031a4035986bef0b2fcef906706d7abf3 (diff) | |
download | cpython-21c7730761e2a768e33b89b063a095d007dcfd2c.zip cpython-21c7730761e2a768e33b89b063a095d007dcfd2c.tar.gz cpython-21c7730761e2a768e33b89b063a095d007dcfd2c.tar.bz2 |
bpo-32089: Use default action for ResourceWarning (#4584)
In development and debug mode, use the "default" action, rather than
the "always" action, for ResourceWarning in the default warnings
filters.
Diffstat (limited to 'Lib/test/test_cmd_line.py')
-rw-r--r-- | Lib/test/test_cmd_line.py | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 75f7d00..7f95fcc 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -532,26 +532,26 @@ class CmdLineTest(unittest.TestCase): out = self.run_xdev("-c", code) self.assertEqual(out, "ignore::BytesWarning " - "always::ResourceWarning " + "default::ResourceWarning " "default::Warning") out = self.run_xdev("-b", "-c", code) self.assertEqual(out, "default::BytesWarning " - "always::ResourceWarning " + "default::ResourceWarning " "default::Warning") out = self.run_xdev("-bb", "-c", code) self.assertEqual(out, "error::BytesWarning " - "always::ResourceWarning " + "default::ResourceWarning " "default::Warning") out = self.run_xdev("-Werror", "-c", code) self.assertEqual(out, "error::Warning " "ignore::BytesWarning " - "always::ResourceWarning " + "default::ResourceWarning " "default::Warning") try: @@ -573,19 +573,6 @@ class CmdLineTest(unittest.TestCase): out = self.run_xdev("-c", code) self.assertEqual(out, "True") - # Make sure that ResourceWarning emitted twice at the same line number - # is logged twice - filename = support.TESTFN - self.addCleanup(support.unlink, filename) - with open(filename, "w", encoding="utf8") as fp: - print("def func(): open(__file__)", file=fp) - print("func()", file=fp) - print("func()", file=fp) - fp.flush() - - out = self.run_xdev(filename) - self.assertEqual(out.count(':1: ResourceWarning: '), 2, out) - class IgnoreEnvironmentTest(unittest.TestCase): |