FawltyDeps icon indicating copy to clipboard operation
FawltyDeps copied to clipboard

Refactor `run_fawltydeps_function` to use `chdir` fixture

Open mknorps opened this issue 1 year ago • 0 comments

Following @jherland's comment #271:

I'm a little worried about these changes. As I understand it, where run_fawltydeps() can use the cwd to actually set the current working directory for the subprocess, run_fawltydeps_functon() cannot do the same, since everything happens in the same process. Instead, you work around that by passing cwd as a basepath/positional argument instead, and the consequence of that is to adjust the expected output here.

I would like to keep test coverage of the fact that when we work on paths relative to cwd, then that is reflected in the output.

I wonder if we can use monkeypatch.chdir to temporarily change cwd while running the tests? However, it probably means changing run_fawltydeps_function() into a pytest fixture (to have access to monkeypatch).

Alternatively, kick this to a later PR, and leave it as run_fawltydeps() instead of run_fawltydeps_function() for now.

mknorps avatar Apr 12 '23 12:04 mknorps