-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathconftest.py
More file actions
54 lines (41 loc) · 1.65 KB
/
conftest.py
File metadata and controls
54 lines (41 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Root conftest: register app-level fixture modules and optional session/global fixtures.
"""
import pytest
def _patch_django_context_copy_py314():
"""Fix Django BaseContext.__copy__ on Python 3.14 (copy(super()) is broken there)."""
import sys
if sys.version_info >= (3, 14): # pragma: no cover
from django.template.context import BaseContext
def __copy__(self):
duplicate = object.__new__(type(self))
duplicate.__dict__ = self.__dict__.copy()
duplicate.dicts = self.dicts[:]
return duplicate
BaseContext.__copy__ = __copy__
def pytest_configure(config): # noqa: F841 (pytest hook; name must match spec)
_patch_django_context_copy_py314()
# Load app-level fixture modules so fixtures from each app are available everywhere.
pytest_plugins = [
"cppa_user_tracker.tests.fixtures",
"core.tests.github_ops.fixtures",
"github_activity_tracker.tests.fixtures",
"boost_library_tracker.tests.fixtures",
"boost_library_docs_tracker.tests.fixtures",
"cppa_pinecone_sync.tests.fixtures",
"cppa_slack_tracker.tests.fixtures",
"boost_library_usage_dashboard.tests.fixtures",
"boost_usage_tracker.tests.fixtures",
"boost_mailing_list_tracker.tests.fixtures",
"boost_collector_runner.tests.fixtures",
]
@pytest.fixture(scope="session")
def test_workspace_dir():
"""Session-scoped path to test workspace (for tests that need a real path)."""
from pathlib import Path
from django.conf import settings
return getattr(
settings,
"WORKSPACE_DIR",
Path(__file__).resolve().parent / ".test_artifacts" / "workspace",
)