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

Function test_nose_setup

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

Source from the content-addressed store, hash-verified

7
8
9def test_nose_setup(pytester: Pytester) -> None:
10 p = pytester.makepyfile(
11 """
12 values = []
13 from nose.tools import with_setup
14
15 @with_setup(lambda: values.append(1), lambda: values.append(2))
16 def test_hello():
17 assert values == [1]
18
19 def test_world():
20 assert values == [1,2]
21
22 test_hello.setup = lambda: values.append(1)
23 test_hello.teardown = lambda: values.append(2)
24 """
25 )
26 result = pytester.runpytest(p, "-p", "nose")
27 result.assert_outcomes(passed=2)
28
29
30def test_setup_func_with_setup_decorator() -> None:

Callers

nothing calls this directly

Calls 3

assert_outcomesMethod · 0.80
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected