Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(95173)

Side by Side Diff: Lib/test/test_faulthandler.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_epoll.py ('k') | Lib/test/test_filecmp.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 from contextlib import contextmanager 1 from contextlib import contextmanager
2 import datetime 2 import datetime
3 import faulthandler 3 import faulthandler
4 import os 4 import os
5 import re 5 import re
6 import signal 6 import signal
7 import subprocess 7 import subprocess
8 import sys 8 import sys
9 from test import support, script_helper 9 from test import support, script_helper
10 from test.script_helper import assert_python_ok 10 from test.script_helper import assert_python_ok
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 def test_disable(self): 212 def test_disable(self):
213 code = """ 213 code = """
214 import faulthandler 214 import faulthandler
215 faulthandler.enable() 215 faulthandler.enable()
216 faulthandler.disable() 216 faulthandler.disable()
217 faulthandler._sigsegv() 217 faulthandler._sigsegv()
218 """.strip() 218 """.strip()
219 not_expected = 'Fatal Python error' 219 not_expected = 'Fatal Python error'
220 stderr, exitcode = self.get_output(code) 220 stderr, exitcode = self.get_output(code)
221 stder = '\n'.join(stderr) 221 stder = '\n'.join(stderr)
222 self.assertTrue(not_expected not in stderr, 222 self.assertNotIn(not_expected, stderr,
223 "%r is present in %r" % (not_expected, stderr)) 223 "%r is present in %r" % (not_expected, stderr))
224 self.assertNotEqual(exitcode, 0) 224 self.assertNotEqual(exitcode, 0)
225 225
226 def test_is_enabled(self): 226 def test_is_enabled(self):
227 orig_stderr = sys.stderr 227 orig_stderr = sys.stderr
228 try: 228 try:
229 # regrtest may replace sys.stderr by io.StringIO object, but 229 # regrtest may replace sys.stderr by io.StringIO object, but
230 # faulthandler.enable() requires that sys.stderr has a fileno() 230 # faulthandler.enable() requires that sys.stderr has a fileno()
231 # method 231 # method
232 sys.stderr = sys.__stderr__ 232 sys.stderr = sys.__stderr__
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 def test_register_threads(self): 588 def test_register_threads(self):
589 self.check_register(all_threads=True) 589 self.check_register(all_threads=True)
590 590
591 def test_register_chain(self): 591 def test_register_chain(self):
592 self.check_register(chain=True) 592 self.check_register(chain=True)
593 593
594 594
595 if __name__ == "__main__": 595 if __name__ == "__main__":
596 unittest.main() 596 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_epoll.py ('k') | Lib/test/test_filecmp.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+