-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
22 lines (16 loc) · 782 Bytes
/
Copy pathconftest.py
File metadata and controls
22 lines (16 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Test configuration.
``[tool.pytest.ini_options] pythonpath = ["src"]`` puts the package on ``sys.path``
for in-process imports. Several tests shell out to ``python -m mlx_kld``, and a
subprocess inherits ``PYTHONPATH`` rather than the parent's ``sys.path``, so export
it there too. Together these let a bare ``pytest`` pass from a fresh clone with no
editable install.
"""
from __future__ import annotations
import os
from pathlib import Path
_SRC = Path(__file__).resolve().parent / "src"
# ``config`` is unused, but pytest matches hook arguments by name, so it stays.
def pytest_configure(config):
existing = os.environ.get("PYTHONPATH", "")
parts = [str(_SRC)] + [p for p in existing.split(os.pathsep) if p]
os.environ["PYTHONPATH"] = os.pathsep.join(parts)