-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathconftest.py
More file actions
22 lines (15 loc) · 737 Bytes
/
Copy pathconftest.py
File metadata and controls
22 lines (15 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Put this problem's `src` on sys.path, so its tests run from anywhere.
pytest loads the nearest conftest.py before importing the test modules beneath
it, which is what makes this work whether you run:
pytest # from this directory
pytest problems/logging-framework # from the repo root
pytest tests/test_logging_framework.py # a single file
It also means the directory is genuinely self-contained: copy it out of the
repository and the tests still run, with no repo-level setup to remember.
"""
from __future__ import annotations
import sys
from pathlib import Path
SRC = Path(__file__).resolve().parent / "src"
if str(SRC) not in sys.path:
sys.path.insert(0, str(SRC))