-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpytest.ini
More file actions
181 lines (142 loc) · 5.77 KB
/
pytest.ini
File metadata and controls
181 lines (142 loc) · 5.77 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# =============================================================================
# Pytest Configuration
# https://docs.pytest.org/en/stable/reference/customize.html
# =============================================================================
#
# This file is portable - copy to other repos without modification.
#
# Run tests:
# poetry run pytest # Run all tests
# poetry run pytest -x # Stop on first failure
# poetry run pytest -k "test_" # Run tests matching pattern
# poetry run pytest -m "unit" # Run only unit tests
# poetry run pytest --no-cov # Skip coverage (faster)
#
# =============================================================================
# =============================================================================
# Core Settings
# =============================================================================
[pytest]
# Minimum pytest version required
minversion = 8.0
# Directory containing tests (relative to pytest.ini)
testpaths = tst
# Patterns for test file discovery
python_files = tests.py test_*.py *_tests.py
# Patterns for test class discovery
python_classes = Test*
# Patterns for test function discovery
python_functions = test_*
# Add src/ and current directory to Python path for imports
pythonpath = .
# =============================================================================
# Django Integration (pytest-django)
# =============================================================================
# Django settings module for test environment
DJANGO_SETTINGS_MODULE = tst.settings
# Don't auto-discover Django project (we set it explicitly)
django_find_project = false
# =============================================================================
# Test Output & Display
# =============================================================================
# Output style: progress, classic, short, long, count, line
console_output_style = progress
# Assertion introspection verbosity (0-2)
verbosity_assertions = 2
# =============================================================================
# JUnit XML Report
# =============================================================================
# JUnit XML format: legacy, xunit1, xunit2
junit_family = xunit2
# Suite name is auto-generated from package name
# =============================================================================
# Custom Markers
# =============================================================================
#
# Register markers to avoid warnings and enable filtering:
# pytest -m "unit" # Run only unit tests
# pytest -m "not slow" # Skip slow tests
# pytest -m "integration" # Run only integration tests
#
# =============================================================================
markers =
slow: marks tests as slow (deselect with '-m "not slow"')
integration: marks tests as integration tests
unit: marks tests as unit tests
transactional_db: marks tests needing database access without transaction wrapping
# =============================================================================
# Warnings Configuration
# =============================================================================
#
# Convert warnings to errors by default, with specific exceptions.
# This helps catch deprecation warnings early.
#
# =============================================================================
filterwarnings =
error
ignore::DeprecationWarning
ignore::PendingDeprecationWarning
ignore::django.utils.deprecation.RemovedInDjango61Warning
ignore::ResourceWarning
# =============================================================================
# Default Command Line Options
# =============================================================================
#
# These options are applied automatically on every pytest run.
# Override with explicit flags: pytest --no-cov --maxfail=10
#
# =============================================================================
addopts =
# Show extra test summary info for all except passed
-ra
# Quiet mode (less verbose output)
-q
# Error on unknown markers or config keys
--strict-config
--strict-markers
# Skip Django migrations (faster tests)
--nomigrations
# Stop after N failures (fail fast)
--maxfail=3
# Show N slowest tests
--durations=10
# Shorter traceback format
--tb=short
# Coverage: measure swing.status package
--cov=swing.status
# Coverage: include branch coverage
--cov-branch
# Coverage: fail if below threshold
--cov-fail-under=60
# Coverage: terminal report (skip fully covered)
--cov-report=term-missing:skip-covered
# Coverage: HTML report
--cov-report=html:tst/reports/htmlcov
# Coverage: XML report (for CI)
--cov-report=xml:tst/reports/coverage.xml
# JUnit XML report (for CI)
--junitxml=tst/reports/junit.xml
# Reuse database between test runs (faster)
--reuse-db
# =============================================================================
# Logging Configuration
# =============================================================================
# Show logs in CLI output (useful for debugging)
log_cli = false
# Minimum log level for CLI output
log_cli_level = WARNING
# Log format for CLI output
log_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s
# Date format for CLI logs
log_cli_date_format = %Y-%m-%d %H:%M:%S
# =============================================================================
# Required Plugins
# =============================================================================
#
# Pytest will fail if these plugins are not installed.
# Install with: poetry install --with dev
#
# =============================================================================
required_plugins =
pytest-django>=4.5
pytest-cov>=4.0