Skip to content

Commit a321688

Browse files
refactor: Run each test in its own directory (#4115)
closes #915 Each test should create its own working directory. I think this will help to avoid hang issue. All tests passed - https://github.com/ansys/pyfluent/actions/runs/15485733732 --------- Co-authored-by: pyansys-ci-bot <[email protected]>
1 parent 996ac17 commit a321688

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Run each test in its own directory

tests/conftest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,18 @@ def pytest_collection_finish(session):
170170

171171
@pytest.fixture(autouse=True)
172172
def run_before_each_test(
173-
monkeypatch: pytest.MonkeyPatch, request: pytest.FixtureRequest
174-
) -> None:
173+
tmp_path,
174+
monkeypatch: pytest.MonkeyPatch,
175+
request: pytest.FixtureRequest,
176+
):
175177
monkeypatch.setenv("PYFLUENT_TEST_NAME", request.node.name)
176178
monkeypatch.setenv("PYFLUENT_CODEGEN_SKIP_BUILTIN_SETTINGS", "1")
177179
pyfluent.CONTAINER_MOUNT_SOURCE = pyfluent.EXAMPLES_PATH
178180
pyfluent.CONTAINER_MOUNT_TARGET = pyfluent.EXAMPLES_PATH
181+
original_cwd = os.getcwd()
182+
monkeypatch.chdir(tmp_path)
183+
yield
184+
os.chdir(original_cwd)
179185

180186

181187
class Helpers:

0 commit comments

Comments
 (0)