create pytest arguments dynamically

This commit is contained in:
Daniel 2023-11-24 14:37:49 +01:00
parent d6f90b1d64
commit 32d61cd297

View file

@ -45,19 +45,39 @@ class Runner:
will run all tests in the file at full_test_path with some command line arguments"""
ic(f"running test: {full_test_path}")
pytest.main(
[
"-v",
"-rp",
str(full_test_path),
"--env_file",
str(self.dotenv_path),
"--tests_dir",
str(self.tests_dir),
"--session_id",
self.session_id,
]
)
command_arguments = []
command_arguments.append("-v")
command_arguments.append("-rp")
command_arguments.append(str(full_test_path))
command_arguments.append("--env_file")
command_arguments.append(str(self.dotenv_path))
command_arguments.append("--tests_dir")
command_arguments.append(str(self.tests_dir))
command_arguments.append("--session_id")
command_arguments.append(self.session_id)
# artifacts dir
output = self.dir_manager.RESULTS / full_test_path.stem
command_arguments.append("--output")
command_arguments.append(str(output))
# tracing
command_arguments.append("--tracing")
command_arguments.append("on")
# disable capturing
# pytest -s # disable all capturing
command_arguments.append("-s")
# headed
command_arguments.append("--headed")
pytest.main(command_arguments)
def show_files(self):
ic(list(self.root_dir.glob("*")))