-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
67 lines (60 loc) · 3.13 KB
/
Copy pathconftest.py
File metadata and controls
67 lines (60 loc) · 3.13 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
55
56
57
58
59
60
61
62
63
64
65
66
67
# conftest = "don't collect tests/playwright/ or tests/e2e/ as pytest tests"
# Both subtrees run outside pytest -- see docs/PLAYWRIGHT_USAGE.md and docs/E2E_TESTS.md.
collect_ignore = ["e2e", "playwright"]
# Standard Library
import sys
# local repo modules
import file_utils
# Add repo root to sys.path so tests can import top-level packages without
# needing `source source_me.sh`. Mirrors what source_me.sh exports via PYTHONPATH.
_REPO_ROOT = file_utils.get_repo_root()
if _REPO_ROOT not in sys.path:
sys.path.insert(0, _REPO_ROOT)
# REPO_HYGIENE_FILTERS is the repo-local hygiene-exclusion registry (Layer 2).
# file_utils.discover_files reads it from this conftest, which is the right
# home because propagation only merges the collect_ignore block above into this
# file; the rest of conftest survives and may differ per repo. Vendored files
# (file_utils.py and every tests/test_*.py) get overwritten by propagation,
# so they must hold no repo-specific data. Put repo-specific exclusions here.
#
# Shape and rules:
# - It is a dict: key -> list of repo-relative POSIX glob patterns.
# - Keys are "all" or a vendored test key. A test key is the test filename
# stem with the leading "test_" removed (test_pyflakes_code_lint.py ->
# "pyflakes_code_lint", test_ascii_compliance.py -> "ascii_compliance").
# - Patterns match repo-relative POSIX paths via fnmatch.fnmatchcase
# (case-sensitive). A match excludes the file from that test.
# - "all" patterns apply to every test; a test-key list applies only when
# that test_key is passed to discover_files.
# - Recursive directory exclusions need an explicit /** because fnmatch's *
# does not cross "/". Use "temp_scripts/**" to exclude a whole subtree.
#
# This template has no repo-specific exclusions, so the registry is empty.
# Example entries (commented out; this repo needs none):
# REPO_HYGIENE_FILTERS = {
# "all": ["temp_scripts/**", "TEMPLATE.py"],
# "ascii_compliance": ["human_readable-*.html"],
# "pyflakes_code_lint": ["devel/scratch_*.py"],
# }
REPO_HYGIENE_FILTERS = {}
# === OPTIONAL_HELPERS_MENU ===
# See meta/docs/PROPAGATION_RULES.md for the managed-block propagation contract.
# This block is an optional helpers menu appended once by propagation and
# never overwritten on subsequent propagation runs. Uncomment a recipe below
# to enable it for this repo. Every line here is a comment by default so an
# untouched consumer behaves exactly as it did before propagation added this
# block.
#
# Note: inserting the repo root onto sys.path is now done unconditionally at the
# top of this file via file_utils.get_repo_root(), so it is no longer a recipe.
#
# --- Recipe 1: redirect matplotlib config dir to a per-repo tmp location ---
# Prevents matplotlib from writing to the home-directory config cache during
# tests, which can cause cross-repo pollution or permission errors in CI.
# Set MPLCONFIGDIR to a writable tmp path before matplotlib is imported.
# Note: PYTHONUNBUFFERED and PYTHONDONTWRITEBYTECODE are handled by
# source_me.sh and belong there, not here.
#
# import os
# import tempfile
# os.environ.setdefault("MPLCONFIGDIR", tempfile.mkdtemp(prefix="mpl_"))