In a project im working on we have a step where we export a csv before exporting we run a regression test step against the report using pytest. pytest is invoked using the following command
JavaScript
x
7
1
def _invoke_pytest(self):
2
pytest.main(['src/tests/regression/regression_tests.py'
3
,"-m",self.expectations_suite
4
,'--sample', self.sample_filepath
5
,'--expectations',self.expectations_suite_filepath
6
,'--report-log',self.logs_report_filepath])
7
–sample and –expectations are custom args defined in the conftest.py using the following
JavaScript
1
4
1
def pytest_addoption(parser):
2
parser.addoption("--sample", default=False)
3
parser.addoption("--expectations", default=False)
4
when calling this code locally it works pytest finds the conf but when inside a docker container it doesnt pick up the conftest and therefore fails on running pytest. a simplified folder layout is as follows
JavaScript
1
8
1
src/
2
├─ main/
3
│ ├─ export
4
│ ├─ invoke_pytest
5
├─ test/
6
│ ├─ regression/
7
│ │ ├─ conftest
8
any help would be greatly appreciated, thanks
Advertisement
Answer
the issue was fixed by moving conftest into the src folder allowed pytest to find it