Python/tests/conftest.py
Simon Diesenreiter 0e9b465413
Some checks are pending
CI / tests_mac (macos-latest, 3.9) (push) Blocked by required conditions
CI / tests_win (windows-latest, 3.9) (push) Blocked by required conditions
CI / linter (ubuntu-latest, 3.9) (push) Successful in 3m30s
Rename the project from template / rename-project (push) Successful in 15s
CI / tests_linux (ubuntu-latest, 3.9) (push) Successful in 42s
initial commit
2024-11-09 08:01:27 -08:00

15 lines
398 B
Python

import sys
import pytest
# each test runs on cwd to its temp dir
@pytest.fixture(autouse=True)
def go_to_tmpdir(request):
# Get the fixture dynamically by its name.
tmpdir = request.getfixturevalue("tmpdir")
# ensure local test created packages can be imported
sys.path.insert(0, str(tmpdir))
# Chdir only for the duration of the test.
with tmpdir.as_cwd():
yield