@@ -178,6 +178,11 @@ def test_subTest_mixed(self):
178
178
with self .subTest (i = i ):
179
179
self .assertLess (i , 1 , msg = 'this is a subtest.' )
180
180
181
+ def test_subTest_with_dots (self ):
182
+ for i in range (2 ):
183
+ with self .subTest (module = 'hello.world.subTest{}' .format (i )):
184
+ self .fail ('this is a subtest.' )
185
+
181
186
class DecoratedUnitTest (unittest .TestCase ):
182
187
183
188
@some_decorator
@@ -553,6 +558,27 @@ def test_unittest_subTest_pass(self):
553
558
suite .addTest (self .DummySubTest ('test_subTest_pass' ))
554
559
self ._test_xmlrunner (suite )
555
560
561
+ @unittest .skipIf (not hasattr (unittest .TestCase , 'subTest' ),
562
+ 'unittest.TestCase.subTest not present.' )
563
+ def test_unittest_subTest_with_dots (self ):
564
+ # Test for issue #85
565
+ suite = unittest .TestSuite ()
566
+ suite .addTest (self .DummySubTest ('test_subTest_with_dots' ))
567
+ outdir = BytesIO ()
568
+
569
+ self ._test_xmlrunner (suite , outdir = outdir )
570
+
571
+ xmlcontent = outdir .getvalue ().decode ()
572
+
573
+ # Method name
574
+ self .assertNotIn ('name="subTest' , xmlcontent , 'parsing of test method name is not done correctly' )
575
+ self .assertIn ('name="test_subTest_with_dots (module=\' hello.world.subTest' , xmlcontent )
576
+
577
+ # Class name
578
+ matchString = 'classname="tests.testsuite.XMLTestRunnerTestCase.DummySubTest.test_subTest_with_dots (module=\' hello.world"'
579
+ self .assertNotIn (matchString , xmlcontent , 'parsing of class name is not done correctly' )
580
+ self .assertIn ('classname="tests.testsuite.XMLTestRunnerTestCase.DummySubTest"' , xmlcontent )
581
+
556
582
def test_xmlrunner_pass (self ):
557
583
suite = unittest .TestSuite ()
558
584
suite .addTest (self .DummyTest ('test_pass' ))
0 commit comments