Skip to content

Commit 81f96a5

Browse files
author
Israel Fruchter (ifruchte)
committed
adding new test for --fixture-graph
1 parent 2185cd5 commit 81f96a5

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/test_fixtrue_graph.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import py
2+
3+
4+
def test_fixture_graph_created(testdir):
5+
"""Check that --show-fixture-duplicates will give us list of duplicates."""
6+
sub1 = testdir.mkpydir("sub1")
7+
sub2 = testdir.mkpydir("sub1/sub2")
8+
sub1.join("conftest.py").write(py.code.Source("""
9+
import pytest
10+
11+
@pytest.fixture
12+
def arg1(request):
13+
pass
14+
"""))
15+
sub2.join("conftest.py").write(py.code.Source("""
16+
import pytest
17+
18+
@pytest.fixture
19+
def arg1(request):
20+
pass
21+
"""))
22+
sub1.join("test_in_sub1.py").write("def test_1(arg1): pass")
23+
sub2.join("test_in_sub2.py").write("def test_2(arg1): pass")
24+
25+
result = testdir.runpytest_subprocess('--fixture-graph', '-s')
26+
27+
result.stdout.fnmatch_lines("created at artifacts/fixture-graph-sub1-test_in_sub1.py__test_1.dot.")
28+
result.stdout.fnmatch_lines("You can convert it to a PNG using 'dot -Tpng artifacts/fixture-graph-sub1"
29+
"-test_in_sub1.py__test_1.dot -o artifacts/fixture-graph-sub1-test_in_sub1"
30+
".py__test_1.png'")
31+
32+
result.stdout.fnmatch_lines("created at artifacts/fixture-graph-sub1-sub2-test_in_sub2.py__test_2.dot.")
33+
result.stdout.fnmatch_lines("You can convert it to a PNG using 'dot -Tpng artifacts/fixture-graph-sub1"
34+
"-sub2-test_in_sub2.py__test_2.dot -o artifacts/fixture-graph-sub1-sub2-te"
35+
"st_in_sub2.py__test_2.png'")

0 commit comments

Comments
 (0)