@@ -44,11 +44,11 @@ def test_method_02(self): assert (1 + 1 == 2) # 'mark_test' marked function
4444 @mark .skip ('This is a skip reason : no need to test this method' )
4545 def test_method_03 (self ): assert (1 + 1 == 2 ) # 'skip' marked function
4646
47- # parametrize is not supported by unittest.TestCase
48- @mark .marker_name3
49- @mark .parametrize ("val" ,[1 ,2 ]) # 'parametrize' may test different values
50- def test_method_04 (self , val ):
51- assert val > 0
47+ # # parametrize is not supported by unittest.TestCase
48+ # @mark.marker_name3
49+ # @mark.parametrize("val",[1,2]) # 'parametrize' may test different values
50+ # def test_method_04(self, val):
51+ # assert val > 0
5252
5353 # and should be modified by using parameterized (following this structure)
5454 @parameterized .expand ([
@@ -57,7 +57,7 @@ def test_method_04(self, val):
5757 ])
5858 @mark .marker_name3 # Careful, the parameterized must not be under marker
5959 def test_method_05 (self ,val1 , val2 ):
60- print (f"Test { val1 } > 0 (no use of { val2 } )" , end = ' ' )
60+ print (f"Test { val1 } > 0 ({ val2 } not used here )" , end = ' ' )
6161 assert val1 > 0 # 'parametrize' to test different values
6262
6363
@@ -77,13 +77,6 @@ class check_05_TestCase_Tests(unittest.TestCase,repeating_checks): pass # 'ma
7777@mark .skip ('This is a skip reason : no need to test this class' )
7878class check_06_TestCase_Tests (unittest .TestCase ,repeating_checks ): pass # 'skip' marked class
7979
80- # # # With unittest.TestCase heritage
81- # @mark.marker_name2
82- # class check_04_TestCase_Tests(repeating_checks): pass
83- # @mark.marker_name
84- # class check_05_TestCase_Tests(repeating_checks): pass # 'mark_test' marked class
85- # @mark.skip('This is a skip reason : no need to test this class')
86- # class check_06_TestCase_Tests(repeating_checks): pass # 'skip' marked class
8780
8881''' pytest considers all tests if pytest.ini file is defined
8982>>> pytest -v -k test_marks.py
@@ -133,7 +126,7 @@ class check_06_TestCase_Tests(unittest.TestCase,repeating_checks): pass # 'sk
133126>>> pytest -v -k test_marks.py -m 'not marker_name'
134127test_marks.py::check_01_Tests::test_method_01 PASSED
135128test_marks.py::check_03_Tests::test_method_01 PASSED
136- test_marks.py::check_04_TestCase_Tesgits ::test_method_01 PASSED
129+ test_marks.py::check_04_TestCase_Tests ::test_method_01 PASSED
137130test_marks.py::check_06_TestCase_Tests::test_method_01 PASSED
138131'''
139132''' WITHOUT pytest.ini file
@@ -194,7 +187,7 @@ class check_06_TestCase_Tests(unittest.TestCase,repeating_checks): pass # 'sk
194187# ])
195188# @mark.marker_name3 # Careful, the parameterized must not be under marker
196189# def test_method_05(self,val1, val2):
197- # print(f"Test {val1} > 0 (no use of {val2})", end=' ')
190+ # print(f"Test {val1} > 0 ({val2} not used here )", end=' ')
198191# assert val1 > 0 # 'parametrize' to test different values
199192#
200193# This required to import and install 'parameterized'
@@ -203,9 +196,9 @@ class check_06_TestCase_Tests(unittest.TestCase,repeating_checks): pass # 'sk
203196>>> pytest -v -k test_marks.py -m 'marker_name and marker_name3' -s
204197test_marks.py::check_02_Tests::test_method_04[1] PASSED
205198test_marks.py::check_02_Tests::test_method_04[2] PASSED
206- test_marks.py::check_02_Tests::test_method_05_0 Test 1 > 0 (no use of 1 ) PASSED
207- test_marks.py::check_02_Tests::test_method_05_1 Test 2 > 0 (no use of 2 ) PASSED
199+ test_marks.py::check_02_Tests::test_method_05_0 Test 1 > 0 (1 not used here ) PASSED
200+ test_marks.py::check_02_Tests::test_method_05_1 Test 2 > 0 (2 not used here ) PASSED
208201test_marks.py::check_05_TestCase_Tests::test_method_04 FAILED # Not support by unittest.TestCase
209- test_marks.py::check_05_TestCase_Tests::test_method_05_0 Test 1 > 0 (no use of 1 ) PASSED
210- test_marks.py::check_05_TestCase_Tests::test_method_05_1 Test 2 > 0 (no use of 2 ) PASSED
202+ test_marks.py::check_05_TestCase_Tests::test_method_05_0 Test 1 > 0 (1 not used here ) PASSED
203+ test_marks.py::check_05_TestCase_Tests::test_method_05_1 Test 2 > 0 (2 not used here ) PASSED
211204'''
0 commit comments