Skip to content

Commit 5f2e85d

Browse files
committed
Watch arg
1 parent e1af1e8 commit 5f2e85d

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

TEST.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Testing requires Python, Wally, Rojo, and Roblox Studio.
44

5-
1. Run `python build_tests.py` (will run in `watch` mode once built)
5+
1. Run `python build_tests.py` or `python build_tests.py watch`
66
2. Run `rojo`
77
3. Sync project into a new Roblox Studio place
88
4. Run the Roblox Studio place

build_tests.py

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from pathlib import Path
33
from shutil import copytree, rmtree, move
44
import os
5+
import sys
56
import time
67
from watchdog.observers import Observer
78
from watchdog.events import PatternMatchingEventHandler
@@ -64,21 +65,29 @@ def build_tests():
6465

6566
if __name__ == "__main__":
6667

68+
if len(sys.argv) >= 2:
69+
has_watch = sys.argv[1].lower() == "watch"
70+
else:
71+
has_watch = False
72+
6773
print("Building tests...")
6874
build_tests()
6975
print("\nTests built")
70-
print("Watching for changes...")
7176

72-
observer = Observer()
73-
observer.schedule(WatchHandler(), "./modules", recursive=True)
74-
observer.start()
75-
76-
try:
77-
while True:
78-
time.sleep(1)
79-
except KeyboardInterrupt:
80-
observer.stop()
81-
finally:
82-
observer.join()
77+
if has_watch:
78+
79+
print("Watching for changes...")
80+
81+
observer = Observer()
82+
observer.schedule(WatchHandler(), "./modules", recursive=True)
83+
observer.start()
84+
85+
try:
86+
while True:
87+
time.sleep(1)
88+
except KeyboardInterrupt:
89+
observer.stop()
90+
finally:
91+
observer.join()
8392

84-
print("Stopped")
93+
print("Stopped")

0 commit comments

Comments
 (0)