@@ -219,9 +219,22 @@ def setUp(self):
219219 re .VERBOSE )
220220
221221 @pytest .fixture (autouse = True )
222- def inject_fixtures (self , caplog , monkeypatch ):
222+ def inject_fixtures (self , caplog , monkeypatch , subtests ):
223+ """Used to add pytest test fixtures to unittest based tests
224+ because adding the name of a fixture to a method does not
225+ make the method available.
226+
227+ So the decrorator runs with autouse=True to set params on
228+ the unittest "self" making the fixtures available for
229+ tests.
230+
231+ If you need another fixture, just add it to the argument list
232+ and assign it to self and pytest will make it available.
233+ """
234+
223235 self ._caplog = caplog
224236 self ._monkeypatch = monkeypatch
237+ self ._subtests = subtests
225238
226239 #
227240 # form label extraction
@@ -1207,10 +1220,13 @@ def hasPermission(s, p, classname=None, d=None, e=None, **kw):
12071220 cl .db .config ['WEB_ALLOWED_API_ORIGINS' ] = ""
12081221
12091222 cl .main ()
1210- self .assertIn (test ['Result' ], out [0 ])
12111223
1212- if "response_code" in test :
1213- self .assertEqual (test ['response_code' ], cl .response_code )
1224+ # make each case above a subtest
1225+ with self ._subtests .test (entry = entry ):
1226+ self .assertIn (test ['Result' ], out [0 ])
1227+
1228+ if "response_code" in test :
1229+ self .assertEqual (test ['response_code' ], cl .response_code )
12141230
12151231 del (out [0 ])
12161232
0 commit comments