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

Function file_structure

testing/test_pythonpath.py:12–47  ·  view source on GitHub ↗
(pytester: Pytester)

Source from the content-addressed store, hash-verified

10
11@pytest.fixture()
12def file_structure(pytester: Pytester) -> None:
13 pytester.makepyfile(
14 test_foo="""
15 from foo import foo
16
17 def test_foo():
18 assert foo() == 1
19 """
20 )
21
22 pytester.makepyfile(
23 test_bar="""
24 from bar import bar
25
26 def test_bar():
27 assert bar() == 2
28 """
29 )
30
31 foo_py = pytester.mkdir("sub") / "foo.py"
32 content = dedent(
33 """
34 def foo():
35 return 1
36 """
37 )
38 foo_py.write_text(content, encoding="utf-8")
39
40 bar_py = pytester.mkdir("sub2") / "bar.py"
41 content = dedent(
42 """
43 def bar():
44 return 2
45 """
46 )
47 bar_py.write_text(content, encoding="utf-8")
48
49
50def test_one_dir(pytester: Pytester, file_structure) -> None:

Callers

nothing calls this directly

Calls 2

makepyfileMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected