MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_apiwrapper_problem_issue260

Function test_apiwrapper_problem_issue260

testing/test_nose.py:285–307  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

283
284
285def test_apiwrapper_problem_issue260(pytester: Pytester) -> None:
286 # this would end up trying a call an optional teardown on the class
287 # for plain unittests we don't want nose behaviour
288 pytester.makepyfile(
289 """
290 import unittest
291 class TestCase(unittest.TestCase):
292 def setup(self):
293 #should not be called in unittest testcases
294 assert 0, 'setup'
295 def teardown(self):
296 #should not be called in unittest testcases
297 assert 0, 'teardown'
298 def setUp(self):
299 print('setup')
300 def tearDown(self):
301 print('teardown')
302 def test_fun(self):
303 pass
304 """
305 )
306 result = pytester.runpytest()
307 result.assert_outcomes(passed=1)
308
309
310def test_setup_teardown_linking_issue265(pytester: Pytester) -> None:

Callers

nothing calls this directly

Calls 3

assert_outcomesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected