MogensR commited on
Commit
d02fbe8
·
1 Parent(s): 7b77141

Create tests/__init__.py

Browse files
Files changed (1) hide show
  1. tests/__init__.py +77 -0
tests/__init__.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ BackgroundFX Pro Test Suite.
3
+ Comprehensive testing for all modules.
4
+ """
5
+
6
+ import os
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ # Add parent directory to path for imports
11
+ parent_dir = Path(__file__).parent.parent
12
+ sys.path.insert(0, str(parent_dir))
13
+
14
+ # Test categories
15
+ TEST_CATEGORIES = {
16
+ 'unit': 'Unit tests for individual components',
17
+ 'integration': 'Integration tests for component interactions',
18
+ 'api': 'API endpoint tests',
19
+ 'models': 'Model management tests',
20
+ 'pipeline': 'Processing pipeline tests',
21
+ 'performance': 'Performance and benchmark tests',
22
+ 'gpu': 'GPU-specific tests'
23
+ }
24
+
25
+ def run_tests(category: str = None, verbose: bool = True):
26
+ """
27
+ Run tests for BackgroundFX Pro.
28
+
29
+ Args:
30
+ category: Optional test category to run
31
+ verbose: Enable verbose output
32
+ """
33
+ import pytest
34
+
35
+ args = []
36
+
37
+ if category:
38
+ if category in TEST_CATEGORIES:
39
+ args.extend(['-m', category])
40
+ else:
41
+ print(f"Unknown category: {category}")
42
+ print(f"Available categories: {', '.join(TEST_CATEGORIES.keys())}")
43
+ return 1
44
+
45
+ if verbose:
46
+ args.append('-v')
47
+
48
+ # Add coverage by default
49
+ args.extend(['--cov=.', '--cov-report=term-missing'])
50
+
51
+ return pytest.main(args)
52
+
53
+
54
+ def run_quick_tests():
55
+ """Run quick unit tests only (no slow/integration tests)."""
56
+ import pytest
57
+ return pytest.main(['-m', 'not slow and not integration', '-v'])
58
+
59
+
60
+ def run_gpu_tests():
61
+ """Run GPU-specific tests if GPU is available."""
62
+ import torch
63
+
64
+ if not torch.cuda.is_available():
65
+ print("No GPU available, skipping GPU tests")
66
+ return 0
67
+
68
+ import pytest
69
+ return pytest.main(['-m', 'gpu', '-v'])
70
+
71
+
72
+ __all__ = [
73
+ 'run_tests',
74
+ 'run_quick_tests',
75
+ 'run_gpu_tests',
76
+ 'TEST_CATEGORIES'
77
+ ]