-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
42 lines (33 loc) · 1.42 KB
/
conftest.py
File metadata and controls
42 lines (33 loc) · 1.42 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
"""
Pytest configuration for Django tests.
Handles Redis configuration and test settings override.
"""
import os
import django
def pytest_configure():
"""Configure pytest with Django settings."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_project.settings")
django.setup()
def pytest_collection_modifyitems(config, items):
"""Mark tests for parallel execution compatibility."""
# List of test IDs/patterns that conflict in parallel execution
# These tests have race conditions or shared state issues
parallel_unsafe_tests = [
"test_redis_integration", # All Redis integration tests
"test_session", # Session tests
"test_cache", # Cache tests
"test_dashboard_summary_caching", # Cache race condition in parallel
"QuickLogViewTests", # Session UpdateError in parallel
"RevokeAccessViewTests", # Invite/access tests with state
"ToggleInviteViewTests", # Toggle invite tests
]
for item in items:
# Mark tests that have timing/state conflicts in parallel execution
test_nodeid = item.nodeid
if any(
unsafe_pattern in test_nodeid for unsafe_pattern in parallel_unsafe_tests
):
item.add_marker("parallel_unsafe")
# Mark analytics tests as potentially requiring Redis
if "analytics" in test_nodeid or "cache" in test_nodeid:
item.add_marker("redis_dependent")