Skip to content

Commit 737f50c

Browse files
committed
Copy and cwd to tmp_dir
1 parent ebcce5c commit 737f50c

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

tests/conftest.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,17 @@ def test_dir(request) -> Path:
1616
@pytest.fixture(autouse=True)
1717
def copy_and_cwd_to_tmp_dir(request, tmp_path, monkeypatch):
1818
"""
19-
Provides a unique, writable copy of a pre-existing input directory
19+
Provides a unique, writable copy of the test directory
2020
and changes cwd to it.
21-
22-
The original directory name is taken from:
23-
- or @pytest.mark.input_dir("name") marker
24-
- default: "data"
2521
"""
2622

27-
marker = request.node.get_closest_marker("input_dir")
28-
original_name = marker.kwargs.get('name', 'data') if marker else "data"
29-
3023
test_file_dir = Path(request.fspath).parent
31-
original_dir = test_file_dir / original_name
3224

33-
if not original_dir.is_dir():
34-
pytest.fail(f"Expected input directory '{original_dir}' not found")
25+
if not test_file_dir.is_dir():
26+
pytest.fail(f"Expected input directory '{test_file_dir}' not found")
3527

3628
# Create unique writable copy
37-
run_dir_path = tmp_path / original_name
38-
shutil.copytree(original_dir, run_dir_path, dirs_exist_ok=True)
29+
run_dir_path = tmp_path / test_file_dir.name
30+
shutil.copytree(test_file_dir, run_dir_path, dirs_exist_ok=True)
3931

40-
monkeypatch.chdir(tmp_path)
32+
monkeypatch.chdir(run_dir_path)

0 commit comments

Comments
 (0)