@@ -110,7 +110,41 @@ the simple test function. And as usual with test function arguments,
110110you can see the ``input `` and ``output `` values in the traceback.
111111
112112Note that you could also use the parametrize marker on a class or a module
113- (see :ref: `mark `) which would invoke several functions with the argument sets.
113+ (see :ref: `mark `) which would invoke several functions with the argument sets,
114+ for instance:
115+
116+
117+ .. code-block :: python
118+
119+ import pytest
120+
121+
122+ @pytest.mark.parametrize (" n,expected" , [(1 , 2 ), (3 , 4 )])
123+ class TestClass :
124+ def test_simple_case (self , n , expected ):
125+ assert n + 1 == expected
126+
127+ def test_weird_simple_case (self , n , expected ):
128+ assert (n * 1 ) + 1 == expected
129+
130+
131+ To parametrize all tests in a module, you can assign to the :globalvar: `pytestmark ` global variable:
132+
133+
134+ .. code-block :: python
135+
136+ import pytest
137+
138+ pytestmark = pytest.mark.parametrize(" n,expected" , [(1 , 2 ), (3 , 4 )])
139+
140+
141+ class TestClass :
142+ def test_simple_case (self , n , expected ):
143+ assert n + 1 == expected
144+
145+ def test_weird_simple_case (self , n , expected ):
146+ assert (n * 1 ) + 1 == expected
147+
114148
115149 It is also possible to mark individual test instances within parametrize,
116150for example with the builtin ``mark.xfail ``:
0 commit comments