MCPcopy Create free account
hub / github.com/ElementsProject/lightning / test_base_dir

Function test_base_dir

contrib/pyln-testing/pyln/testing/fixtures.py:26–43  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24
25@pytest.fixture(scope="session")
26def test_base_dir():
27 d = os.getenv("TEST_DIR", "/tmp")
28
29 directory = tempfile.mkdtemp(prefix='ltests-', dir=d)
30 print("Running tests in {}".format(directory))
31
32 yield directory
33
34 # Now check if any test directory is left because the corresponding test
35 # failed. If there are no such tests we can clean up the root test
36 # directory.
37 contents = [d for d in os.listdir(directory) if os.path.isdir(os.path.join(directory, d)) and d.startswith('test_')]
38 if contents == []:
39 shutil.rmtree(directory)
40 else:
41 print("Leaving base_dir {} intact, it still has test sub-directories with failure details: {}".format(
42 directory, contents
43 ))
44
45
46@pytest.fixture(autouse=True)

Callers

nothing calls this directly

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected