Continuing from Testing file input/output syntax - #11 by BethanyG
I have a commit which I think does everything that is needed. Regardless of how/what/where pytest
is executed, that process should be able to create a temp dir and write to it. Any chdir
executed inside pytest
would not impact the runner’s environment. Unless the test infrastructure relies on pytest
somehow writing output and relies on the value of the CWD being predictable after the test setUp()
and before tearDown()
, both the runner and pytest
should not see any changes to the CWD. The pytest
will, for the duration of the unit test, change directories, populate files and run the grep()
function. After the grep()
function returns, the pytest
working directory will revert and the tempdir will be cleaned up. The directory changes should not impact the test runner.