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

Function test_nose_setup_func

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

Source from the content-addressed store, hash-verified

51
52
53def test_nose_setup_func(pytester: Pytester) -> None:
54 p = pytester.makepyfile(
55 """
56 from nose.tools import with_setup
57
58 values = []
59
60 def my_setup():
61 a = 1
62 values.append(a)
63
64 def my_teardown():
65 b = 2
66 values.append(b)
67
68 @with_setup(my_setup, my_teardown)
69 def test_hello():
70 print(values)
71 assert values == [1]
72
73 def test_world():
74 print(values)
75 assert values == [1,2]
76
77 """
78 )
79 result = pytester.runpytest(p, "-p", "nose")
80 result.assert_outcomes(passed=2)
81
82
83def test_nose_setup_func_failure(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