Skip to content

Commit 630172b

Browse files
Anis Camposanis-campos
authored andcommitted
test direct import
1 parent cb653a0 commit 630172b

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from pytest import fixture
2+
3+
4+
@fixture
5+
def simple_decorator():
6+
"""the fixture using the decorator without executing it"""
7+
8+
9+
def test_simple_fixture(simple_decorator):
10+
assert True
11+
12+
13+
@fixture()
14+
def un_configured_decorated():
15+
"""the decorated is called without argument, like scope"""
16+
17+
18+
def test_un_configured_decorated(un_configured_decorated):
19+
assert True
20+
21+
22+
@fixture(scope="function")
23+
def configured_decorated():
24+
"""the decorated is called with argument, like scope"""
25+
26+
27+
def test_un_configured_decorated(configured_decorated):
28+
assert True

tests/test_redefined_outer_name.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ def test_caller_not_a_test_func(self, enable_plugin):
2929
def test_args_and_kwargs(self, enable_plugin):
3030
self.run_linter(enable_plugin)
3131
self.verify_messages(2)
32+
33+
@pytest.mark.parametrize('enable_plugin', [True, False])
34+
def test_direct_import(self, enable_plugin):
35+
"""the fixture method is directly imported """
36+
self.run_linter(enable_plugin)
37+
self.verify_messages(0 if enable_plugin else 3)

0 commit comments

Comments
 (0)