-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_basic_functionality.py
More file actions
66 lines (55 loc) · 2.11 KB
/
test_basic_functionality.py
File metadata and controls
66 lines (55 loc) · 2.11 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
#!/usr/bin/env python3
"""Simple validation test for Greygor enhanced features."""
import sys
import tempfile
import os
from pathlib import Path
# Add the home/engine/project to the path
sys.path.insert(0, str(Path(__file__).parent))
def test_basic_imports():
"""Test that all enhanced modules can be imported."""
try:
import greygor
print("✓ Basic import works")
# Test configuration classes
config = greygor.EnhancedDetectorConfig(window_size=5, min_events=10)
print("✓ EnhancedDetectorConfig creation works")
# Test custom exceptions
try:
raise greygor.ConfigurationError('Test error')
except greygor.ConfigurationError:
print("✓ Custom exceptions work")
# Test logging configuration
log_config = greygor.LoggingConfig(level='DEBUG')
greygor.configure_logging(log_config)
print("✓ Logging configuration works")
# Test utility functions
detector = greygor.create_detector(['.'])
print("✓ create_detector utility function works")
# Test basic detector functionality
with tempfile.TemporaryDirectory() as tmpdir:
detector = greygor.GreygorDetector([tmpdir])
event = greygor.FileEvent(
path=os.path.join(tmpdir, 'test.txt'),
timestamp=1.0,
before_bytes=b'old',
after_bytes=b'new',
ext_before='.txt',
ext_after='.txt'
)
snapshot = detector.update(event)
print("✓ Basic detector functionality works")
return True
except Exception as e:
print(f"✗ Test failed: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = test_basic_imports()
if success:
print("\n🎉 All basic tests passed! Greygor enhanced features are working correctly.")
sys.exit(0)
else:
print("\n❌ Some tests failed. Please check the output above.")
sys.exit(1)