Skip to content

Commit 94cb6c1

Browse files
committed
Log folder setup to be run once per test suite (not per test)
1 parent 98e688e commit 94cb6c1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

conftest.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def pytest_configure(config):
5454
config_file.write("with_testing_base:::%s\n" % with_testing_base)
5555
config_file.write("log_path:::%s\n" % log_path)
5656
config_file.close()
57+
log_folder_setup(config)
5758

5859

5960
def pytest_unconfigure():
@@ -62,11 +63,11 @@ def pytest_unconfigure():
6263
os.remove(pytest_config)
6364

6465

65-
def pytest_runtest_setup():
66+
def log_folder_setup(config):
6667
# Handle Logging
67-
with_testing_base = pytest.config.getoption('with_testing_base')
68+
with_testing_base = config.getoption('with_testing_base')
6869
if with_testing_base:
69-
log_path = pytest.config.getoption('log_path')
70+
log_path = config.getoption('log_path')
7071
if log_path.endswith("/"):
7172
log_path = log_path[:-1]
7273
if not os.path.exists(log_path):
@@ -82,6 +83,11 @@ def pytest_runtest_setup():
8283
shutil.rmtree(archived_logs)
8384

8485

86+
def pytest_runtest_setup():
87+
# A placeholder for a method that runs before every test with pytest
88+
pass
89+
90+
8591
def pytest_runtest_teardown():
8692
# A placeholder for a method that runs after every test with pytest
8793
pass

0 commit comments

Comments
 (0)