blob: 5c333b7a0a5e36d271371f1ca12b0c6386480e88 [file] [log] [blame]
Alexander Belopolsky4d770172010-09-13 18:14:34 +00001import os
2import sys
Serhiy Storchakacbfe07e2015-05-20 19:37:10 +03003from test.support import TESTFN, rmtree, unlink, captured_stdout
Senthil Kumaran436831d2016-01-13 07:46:54 -08004from test.support.script_helper import assert_python_ok, assert_python_failure
Michael Selik47ab1542018-04-30 20:46:52 -07005import textwrap
Georg Brandl283b1252010-08-02 12:48:46 +00006import unittest
Georg Brandl283b1252010-08-02 12:48:46 +00007
Alexander Belopolsky4d770172010-09-13 18:14:34 +00008import trace
Senthil Kumaran96b531a2016-01-11 07:09:42 -08009from trace import Trace
Alexander Belopolsky4d770172010-09-13 18:14:34 +000010
11from test.tracedmodules import testmod
12
Alexander Belopolsky4d770172010-09-13 18:14:34 +000013#------------------------------- Utilities -----------------------------------#
14
15def fix_ext_py(filename):
Brett Cannonf299abd2015-04-13 14:21:02 -040016 """Given a .pyc filename converts it to the appropriate .py"""
17 if filename.endswith('.pyc'):
Alexander Belopolsky4d770172010-09-13 18:14:34 +000018 filename = filename[:-1]
19 return filename
20
21def my_file_and_modname():
22 """The .py file and module name of this file (__file__)"""
23 modname = os.path.splitext(os.path.basename(__file__))[0]
24 return fix_ext_py(__file__), modname
25
26def get_firstlineno(func):
27 return func.__code__.co_firstlineno
28
29#-------------------- Target functions for tracing ---------------------------#
30#
31# The relative line numbers of lines in these functions matter for verifying
32# tracing. Please modify the appropriate tests if you change one of the
33# functions. Absolute line numbers don't matter.
34#
35
36def traced_func_linear(x, y):
37 a = x
38 b = y
39 c = a + b
40 return c
41
42def traced_func_loop(x, y):
43 c = x
44 for i in range(5):
45 c += y
46 return c
47
48def traced_func_importing(x, y):
49 return x + y + testmod.func(1)
50
51def traced_func_simple_caller(x):
52 c = traced_func_linear(x, x)
53 return c + x
54
55def traced_func_importing_caller(x):
56 k = traced_func_simple_caller(x)
57 k += traced_func_importing(k, x)
58 return k
59
60def traced_func_generator(num):
61 c = 5 # executed once
62 for i in range(num):
63 yield i + c
64
65def traced_func_calling_generator():
66 k = 0
67 for i in traced_func_generator(10):
68 k += i
69
70def traced_doubler(num):
71 return num * 2
72
73def traced_caller_list_comprehension():
74 k = 10
75 mylist = [traced_doubler(i) for i in range(k)]
76 return mylist
77
Serhiy Storchaka95b6acf2018-10-30 13:16:02 +020078def traced_decorated_function():
79 def decorator1(f):
80 return f
81 def decorator_fabric():
82 def decorator2(f):
83 return f
84 return decorator2
85 @decorator1
86 @decorator_fabric()
87 def func():
88 pass
89 func()
90
Alexander Belopolsky4d770172010-09-13 18:14:34 +000091
92class TracedClass(object):
93 def __init__(self, x):
94 self.a = x
95
96 def inst_method_linear(self, y):
97 return self.a + y
98
99 def inst_method_calling(self, x):
100 c = self.inst_method_linear(x)
101 return c + traced_func_linear(x, c)
102
103 @classmethod
104 def class_method_linear(cls, y):
105 return y * 2
106
107 @staticmethod
108 def static_method_linear(y):
109 return y * 2
110
111
112#------------------------------ Test cases -----------------------------------#
113
114
115class TestLineCounts(unittest.TestCase):
116 """White-box testing of line-counting, via runfunc"""
117 def setUp(self):
Brett Cannon31f59292011-02-21 19:29:56 +0000118 self.addCleanup(sys.settrace, sys.gettrace())
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000119 self.tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0)
120 self.my_py_filename = fix_ext_py(__file__)
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000121
122 def test_traced_func_linear(self):
123 result = self.tracer.runfunc(traced_func_linear, 2, 5)
124 self.assertEqual(result, 7)
125
126 # all lines are executed once
127 expected = {}
128 firstlineno = get_firstlineno(traced_func_linear)
129 for i in range(1, 5):
130 expected[(self.my_py_filename, firstlineno + i)] = 1
131
132 self.assertEqual(self.tracer.results().counts, expected)
133
134 def test_traced_func_loop(self):
135 self.tracer.runfunc(traced_func_loop, 2, 3)
136
137 firstlineno = get_firstlineno(traced_func_loop)
138 expected = {
139 (self.my_py_filename, firstlineno + 1): 1,
140 (self.my_py_filename, firstlineno + 2): 6,
141 (self.my_py_filename, firstlineno + 3): 5,
142 (self.my_py_filename, firstlineno + 4): 1,
143 }
144 self.assertEqual(self.tracer.results().counts, expected)
145
146 def test_traced_func_importing(self):
147 self.tracer.runfunc(traced_func_importing, 2, 5)
148
149 firstlineno = get_firstlineno(traced_func_importing)
150 expected = {
151 (self.my_py_filename, firstlineno + 1): 1,
152 (fix_ext_py(testmod.__file__), 2): 1,
153 (fix_ext_py(testmod.__file__), 3): 1,
154 }
155
156 self.assertEqual(self.tracer.results().counts, expected)
157
158 def test_trace_func_generator(self):
159 self.tracer.runfunc(traced_func_calling_generator)
160
161 firstlineno_calling = get_firstlineno(traced_func_calling_generator)
162 firstlineno_gen = get_firstlineno(traced_func_generator)
163 expected = {
164 (self.my_py_filename, firstlineno_calling + 1): 1,
165 (self.my_py_filename, firstlineno_calling + 2): 11,
166 (self.my_py_filename, firstlineno_calling + 3): 10,
167 (self.my_py_filename, firstlineno_gen + 1): 1,
168 (self.my_py_filename, firstlineno_gen + 2): 11,
169 (self.my_py_filename, firstlineno_gen + 3): 10,
170 }
171 self.assertEqual(self.tracer.results().counts, expected)
172
173 def test_trace_list_comprehension(self):
174 self.tracer.runfunc(traced_caller_list_comprehension)
175
176 firstlineno_calling = get_firstlineno(traced_caller_list_comprehension)
177 firstlineno_called = get_firstlineno(traced_doubler)
178 expected = {
179 (self.my_py_filename, firstlineno_calling + 1): 1,
180 # List compehentions work differently in 3.x, so the count
181 # below changed compared to 2.x.
182 (self.my_py_filename, firstlineno_calling + 2): 12,
183 (self.my_py_filename, firstlineno_calling + 3): 1,
184 (self.my_py_filename, firstlineno_called + 1): 10,
185 }
186 self.assertEqual(self.tracer.results().counts, expected)
187
Serhiy Storchaka95b6acf2018-10-30 13:16:02 +0200188 def test_traced_decorated_function(self):
189 self.tracer.runfunc(traced_decorated_function)
190
191 firstlineno = get_firstlineno(traced_decorated_function)
192 expected = {
193 (self.my_py_filename, firstlineno + 1): 1,
194 (self.my_py_filename, firstlineno + 2): 1,
195 (self.my_py_filename, firstlineno + 3): 1,
196 (self.my_py_filename, firstlineno + 4): 1,
197 (self.my_py_filename, firstlineno + 5): 1,
198 (self.my_py_filename, firstlineno + 6): 1,
199 (self.my_py_filename, firstlineno + 7): 1,
200 (self.my_py_filename, firstlineno + 8): 1,
201 (self.my_py_filename, firstlineno + 9): 1,
202 (self.my_py_filename, firstlineno + 10): 1,
203 (self.my_py_filename, firstlineno + 11): 1,
204 }
205 self.assertEqual(self.tracer.results().counts, expected)
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000206
207 def test_linear_methods(self):
208 # XXX todo: later add 'static_method_linear' and 'class_method_linear'
209 # here, once issue1764286 is resolved
210 #
211 for methname in ['inst_method_linear',]:
212 tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0)
213 traced_obj = TracedClass(25)
214 method = getattr(traced_obj, methname)
215 tracer.runfunc(method, 20)
216
217 firstlineno = get_firstlineno(method)
218 expected = {
219 (self.my_py_filename, firstlineno + 1): 1,
220 }
221 self.assertEqual(tracer.results().counts, expected)
222
Serhiy Storchaka95b6acf2018-10-30 13:16:02 +0200223
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000224class TestRunExecCounts(unittest.TestCase):
225 """A simple sanity test of line-counting, via runctx (exec)"""
226 def setUp(self):
227 self.my_py_filename = fix_ext_py(__file__)
Brett Cannon31f59292011-02-21 19:29:56 +0000228 self.addCleanup(sys.settrace, sys.gettrace())
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000229
230 def test_exec_counts(self):
231 self.tracer = Trace(count=1, trace=0, countfuncs=0, countcallers=0)
232 code = r'''traced_func_loop(2, 5)'''
233 code = compile(code, __file__, 'exec')
234 self.tracer.runctx(code, globals(), vars())
235
236 firstlineno = get_firstlineno(traced_func_loop)
237 expected = {
238 (self.my_py_filename, firstlineno + 1): 1,
239 (self.my_py_filename, firstlineno + 2): 6,
240 (self.my_py_filename, firstlineno + 3): 5,
241 (self.my_py_filename, firstlineno + 4): 1,
242 }
243
Ezio Melotti13925002011-03-16 11:05:33 +0200244 # When used through 'run', some other spurious counts are produced, like
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000245 # the settrace of threading, which we ignore, just making sure that the
246 # counts fo traced_func_loop were right.
247 #
248 for k in expected.keys():
249 self.assertEqual(self.tracer.results().counts[k], expected[k])
250
251
252class TestFuncs(unittest.TestCase):
253 """White-box testing of funcs tracing"""
254 def setUp(self):
Brett Cannon31f59292011-02-21 19:29:56 +0000255 self.addCleanup(sys.settrace, sys.gettrace())
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000256 self.tracer = Trace(count=0, trace=0, countfuncs=1)
257 self.filemod = my_file_and_modname()
Alexander Belopolskyf026dae2014-06-29 17:44:05 -0400258 self._saved_tracefunc = sys.gettrace()
259
260 def tearDown(self):
261 if self._saved_tracefunc is not None:
262 sys.settrace(self._saved_tracefunc)
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000263
264 def test_simple_caller(self):
265 self.tracer.runfunc(traced_func_simple_caller, 1)
266
267 expected = {
268 self.filemod + ('traced_func_simple_caller',): 1,
269 self.filemod + ('traced_func_linear',): 1,
270 }
271 self.assertEqual(self.tracer.results().calledfuncs, expected)
272
273 def test_loop_caller_importing(self):
274 self.tracer.runfunc(traced_func_importing_caller, 1)
275
276 expected = {
277 self.filemod + ('traced_func_simple_caller',): 1,
278 self.filemod + ('traced_func_linear',): 1,
279 self.filemod + ('traced_func_importing_caller',): 1,
280 self.filemod + ('traced_func_importing',): 1,
281 (fix_ext_py(testmod.__file__), 'testmod', 'func'): 1,
282 }
283 self.assertEqual(self.tracer.results().calledfuncs, expected)
284
Brett Cannon7a540732011-02-22 03:04:06 +0000285 @unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
286 'pre-existing trace function throws off measurements')
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000287 def test_inst_method_calling(self):
288 obj = TracedClass(20)
289 self.tracer.runfunc(obj.inst_method_calling, 1)
290
291 expected = {
292 self.filemod + ('TracedClass.inst_method_calling',): 1,
293 self.filemod + ('TracedClass.inst_method_linear',): 1,
294 self.filemod + ('traced_func_linear',): 1,
295 }
296 self.assertEqual(self.tracer.results().calledfuncs, expected)
297
Serhiy Storchaka95b6acf2018-10-30 13:16:02 +0200298 def test_traced_decorated_function(self):
299 self.tracer.runfunc(traced_decorated_function)
300
301 expected = {
302 self.filemod + ('traced_decorated_function',): 1,
303 self.filemod + ('decorator_fabric',): 1,
304 self.filemod + ('decorator2',): 1,
305 self.filemod + ('decorator1',): 1,
306 self.filemod + ('func',): 1,
307 }
308 self.assertEqual(self.tracer.results().calledfuncs, expected)
309
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000310
311class TestCallers(unittest.TestCase):
312 """White-box testing of callers tracing"""
313 def setUp(self):
Brett Cannon31f59292011-02-21 19:29:56 +0000314 self.addCleanup(sys.settrace, sys.gettrace())
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000315 self.tracer = Trace(count=0, trace=0, countcallers=1)
316 self.filemod = my_file_and_modname()
317
Brett Cannon7a540732011-02-22 03:04:06 +0000318 @unittest.skipIf(hasattr(sys, 'gettrace') and sys.gettrace(),
319 'pre-existing trace function throws off measurements')
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000320 def test_loop_caller_importing(self):
321 self.tracer.runfunc(traced_func_importing_caller, 1)
322
323 expected = {
324 ((os.path.splitext(trace.__file__)[0] + '.py', 'trace', 'Trace.runfunc'),
325 (self.filemod + ('traced_func_importing_caller',))): 1,
326 ((self.filemod + ('traced_func_simple_caller',)),
327 (self.filemod + ('traced_func_linear',))): 1,
328 ((self.filemod + ('traced_func_importing_caller',)),
329 (self.filemod + ('traced_func_simple_caller',))): 1,
330 ((self.filemod + ('traced_func_importing_caller',)),
331 (self.filemod + ('traced_func_importing',))): 1,
332 ((self.filemod + ('traced_func_importing',)),
333 (fix_ext_py(testmod.__file__), 'testmod', 'func')): 1,
334 }
335 self.assertEqual(self.tracer.results().callers, expected)
336
337
338# Created separately for issue #3821
Georg Brandl283b1252010-08-02 12:48:46 +0000339class TestCoverage(unittest.TestCase):
Brett Cannon31f59292011-02-21 19:29:56 +0000340 def setUp(self):
341 self.addCleanup(sys.settrace, sys.gettrace())
342
Georg Brandl283b1252010-08-02 12:48:46 +0000343 def tearDown(self):
344 rmtree(TESTFN)
345 unlink(TESTFN)
346
Alexander Belopolskyff09ce22010-09-24 18:03:12 +0000347 def _coverage(self, tracer,
Serhiy Storchakacbfe07e2015-05-20 19:37:10 +0300348 cmd='import test.support, test.test_pprint;'
349 'test.support.run_unittest(test.test_pprint.QueryTestCase)'):
Alexander Belopolskyff09ce22010-09-24 18:03:12 +0000350 tracer.run(cmd)
Georg Brandl283b1252010-08-02 12:48:46 +0000351 r = tracer.results()
352 r.write_results(show_missing=True, summary=True, coverdir=TESTFN)
353
354 def test_coverage(self):
355 tracer = trace.Trace(trace=0, count=1)
356 with captured_stdout() as stdout:
357 self._coverage(tracer)
358 stdout = stdout.getvalue()
Serhiy Storchaka62e32d62016-11-11 12:05:01 +0200359 self.assertIn("pprint.py", stdout)
360 self.assertIn("case.py", stdout) # from unittest
Georg Brandl283b1252010-08-02 12:48:46 +0000361 files = os.listdir(TESTFN)
Serhiy Storchaka62e32d62016-11-11 12:05:01 +0200362 self.assertIn("pprint.cover", files)
363 self.assertIn("unittest.case.cover", files)
Georg Brandl283b1252010-08-02 12:48:46 +0000364
365 def test_coverage_ignore(self):
366 # Ignore all files, nothing should be traced nor printed
367 libpath = os.path.normpath(os.path.dirname(os.__file__))
368 # sys.prefix does not work when running from a checkout
Vinay Sajip7ded1f02012-05-26 03:45:29 +0100369 tracer = trace.Trace(ignoredirs=[sys.base_prefix, sys.base_exec_prefix,
370 libpath], trace=0, count=1)
Georg Brandl283b1252010-08-02 12:48:46 +0000371 with captured_stdout() as stdout:
372 self._coverage(tracer)
Georg Brandl283b1252010-08-02 12:48:46 +0000373 if os.path.exists(TESTFN):
374 files = os.listdir(TESTFN)
Brett Cannonfd074152012-04-14 14:10:13 -0400375 self.assertEqual(files, ['_importlib.cover']) # Ignore __import__
Georg Brandl283b1252010-08-02 12:48:46 +0000376
Alexander Belopolskyff09ce22010-09-24 18:03:12 +0000377 def test_issue9936(self):
378 tracer = trace.Trace(trace=0, count=1)
379 modname = 'test.tracedmodules.testmod'
380 # Ensure that the module is executed in import
381 if modname in sys.modules:
382 del sys.modules[modname]
383 cmd = ("import test.tracedmodules.testmod as t;"
384 "t.func(0); t.func2();")
385 with captured_stdout() as stdout:
386 self._coverage(tracer, cmd)
387 stdout.seek(0)
388 stdout.readline()
389 coverage = {}
390 for line in stdout:
391 lines, cov, module = line.split()[:3]
392 coverage[module] = (int(lines), int(cov[:-1]))
Alexander Belopolskya847c812010-09-24 22:04:22 +0000393 # XXX This is needed to run regrtest.py as a script
Alexander Belopolsky1f75f5d2010-11-26 18:51:39 +0000394 modname = trace._fullmodname(sys.modules[modname].__file__)
Alexander Belopolskyff09ce22010-09-24 18:03:12 +0000395 self.assertIn(modname, coverage)
396 self.assertEqual(coverage[modname], (5, 100))
397
Alexander Belopolsky6672ea92010-11-08 18:32:40 +0000398### Tests that don't mess with sys.settrace and can be traced
399### themselves TODO: Skip tests that do mess with sys.settrace when
400### regrtest is invoked with -T option.
401class Test_Ignore(unittest.TestCase):
402 def test_ignored(self):
Alexander Belopolsky18c33732010-11-08 23:10:20 +0000403 jn = os.path.join
Alexander Belopolsky1f75f5d2010-11-26 18:51:39 +0000404 ignore = trace._Ignore(['x', 'y.z'], [jn('foo', 'bar')])
Alexander Belopolsky6672ea92010-11-08 18:32:40 +0000405 self.assertTrue(ignore.names('x.py', 'x'))
406 self.assertFalse(ignore.names('xy.py', 'xy'))
407 self.assertFalse(ignore.names('y.py', 'y'))
Alexander Belopolsky18c33732010-11-08 23:10:20 +0000408 self.assertTrue(ignore.names(jn('foo', 'bar', 'baz.py'), 'baz'))
409 self.assertFalse(ignore.names(jn('bar', 'z.py'), 'z'))
Alexander Belopolsky6672ea92010-11-08 18:32:40 +0000410 # Matched before.
Alexander Belopolsky18c33732010-11-08 23:10:20 +0000411 self.assertTrue(ignore.names(jn('bar', 'baz.py'), 'baz'))
Alexander Belopolsky6672ea92010-11-08 18:32:40 +0000412
Michael Selik47ab1542018-04-30 20:46:52 -0700413# Created for Issue 31908 -- CLI utility not writing cover files
414class TestCoverageCommandLineOutput(unittest.TestCase):
415
416 codefile = 'tmp.py'
417 coverfile = 'tmp.cover'
418
419 def setUp(self):
420 with open(self.codefile, 'w') as f:
421 f.write(textwrap.dedent('''\
422 x = 42
423 if []:
424 print('unreachable')
425 '''))
426
427 def tearDown(self):
428 unlink(self.codefile)
429 unlink(self.coverfile)
430
431 def test_cover_files_written_no_highlight(self):
Serhiy Storchakab44a1d42018-08-27 13:10:36 +0300432 # Test also that the cover file for the trace module is not created
433 # (issue #34171).
434 tracedir = os.path.dirname(os.path.abspath(trace.__file__))
435 tracecoverpath = os.path.join(tracedir, 'trace.cover')
436 unlink(tracecoverpath)
437
Michael Selik47ab1542018-04-30 20:46:52 -0700438 argv = '-m trace --count'.split() + [self.codefile]
439 status, stdout, stderr = assert_python_ok(*argv)
Serhiy Storchakac406d5c2018-08-25 10:27:55 +0300440 self.assertEqual(stderr, b'')
Serhiy Storchakac406d5c2018-08-25 10:27:55 +0300441 self.assertFalse(os.path.exists(tracecoverpath))
Michael Selik47ab1542018-04-30 20:46:52 -0700442 self.assertTrue(os.path.exists(self.coverfile))
443 with open(self.coverfile) as f:
444 self.assertEqual(f.read(),
445 " 1: x = 42\n"
446 " 1: if []:\n"
447 " print('unreachable')\n"
448 )
449
450 def test_cover_files_written_with_highlight(self):
451 argv = '-m trace --count --missing'.split() + [self.codefile]
452 status, stdout, stderr = assert_python_ok(*argv)
453 self.assertTrue(os.path.exists(self.coverfile))
454 with open(self.coverfile) as f:
455 self.assertEqual(f.read(), textwrap.dedent('''\
456 1: x = 42
457 1: if []:
458 >>>>>> print('unreachable')
459 '''))
460
Senthil Kumaran436831d2016-01-13 07:46:54 -0800461class TestCommandLine(unittest.TestCase):
462
463 def test_failures(self):
464 _errors = (
465 (b'filename is missing: required with the main options', '-l', '-T'),
466 (b'cannot specify both --listfuncs and (--trace or --count)', '-lc'),
467 (b'argument -R/--no-report: not allowed with argument -r/--report', '-rR'),
468 (b'must specify one of --trace, --count, --report, --listfuncs, or --trackcalls', '-g'),
469 (b'-r/--report requires -f/--file', '-r'),
470 (b'--summary can only be used with --count or --report', '-sT'),
471 (b'unrecognized arguments: -y', '-y'))
472 for message, *args in _errors:
473 *_, stderr = assert_python_failure('-m', 'trace', *args)
474 self.assertIn(message, stderr)
475
476 def test_listfuncs_flag_success(self):
477 with open(TESTFN, 'w') as fd:
478 self.addCleanup(unlink, TESTFN)
479 fd.write("a = 1\n")
480 status, stdout, stderr = assert_python_ok('-m', 'trace', '-l', TESTFN)
481 self.assertIn(b'functions called:', stdout)
Georg Brandl283b1252010-08-02 12:48:46 +0000482
Kyle Altendorf9f422322018-02-16 22:32:37 -0800483 def test_sys_argv_list(self):
484 with open(TESTFN, 'w') as fd:
485 self.addCleanup(unlink, TESTFN)
486 fd.write("import sys\n")
487 fd.write("print(type(sys.argv))\n")
488
489 status, direct_stdout, stderr = assert_python_ok(TESTFN)
490 status, trace_stdout, stderr = assert_python_ok('-m', 'trace', '-l', TESTFN)
491 self.assertIn(direct_stdout.strip(), trace_stdout)
492
Berker Peksagc8b0dbc2018-08-11 09:15:43 +0300493 def test_count_and_summary(self):
494 filename = f'{TESTFN}.py'
495 coverfilename = f'{TESTFN}.cover'
496 with open(filename, 'w') as fd:
497 self.addCleanup(unlink, filename)
498 self.addCleanup(unlink, coverfilename)
499 fd.write(textwrap.dedent("""\
500 x = 1
501 y = 2
502
503 def f():
504 return x + y
505
506 for i in range(10):
507 f()
508 """))
509 status, stdout, _ = assert_python_ok('-m', 'trace', '-cs', filename)
510 stdout = stdout.decode()
511 self.assertEqual(status, 0)
512 self.assertIn('lines cov% module (path)', stdout)
513 self.assertIn(f'6 100% {TESTFN} ({filename})', stdout)
514
Alexander Belopolsky4d770172010-09-13 18:14:34 +0000515if __name__ == '__main__':
Serhiy Storchakacbfe07e2015-05-20 19:37:10 +0300516 unittest.main()