-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathwatch_tests.py
More file actions
38 lines (33 loc) · 1.19 KB
/
watch_tests.py
File metadata and controls
38 lines (33 loc) · 1.19 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
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import subprocess
class TestRunner(FileSystemEventHandler):
def on_any_event(self, event):
try:
# print(subprocess.check_output(['python3', 'tests/test_parsing.py']).decode('utf-8'))
# print(subprocess.check_output(['python3', 'tests/test_querying.py']).decode('utf-8'))
# print(subprocess.check_output(['python3', 'tests/test_textutils.py']).decode('utf-8'))
# print(subprocess.check_output(['python3', 'tests/test_todos.py']).decode('utf-8'))
print(subprocess.check_output(['python3', 'tests/test_query_lexer.py']).decode('utf-8'))
except:
pass
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
path = '.'
event_handler = TestRunner()
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()