Skip to content

Commit 8231eaf

Browse files
committed
self_test: add new test for project config
Signed-off-by: Richard Alpe <[email protected]>
1 parent e97a078 commit 8231eaf

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

self_test/configs/proj-test1.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
9pm:
2+
PROJECT-NAME: "Self Test 1"
3+
PROJECT-ROOT: "./"

self_test/configs/proj-test2.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
9pm:
2+
PROJECT-NAME: "Self Test 2"
3+
PROJECT-ROOT: "./"

self_test/run.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,11 +272,28 @@ def test_verbose_flag(self):
272272
"""Verify that that 9pm verbose output works (-v)"""
273273

274274
self.run(["cases/worker.py", "cases/worker.py"], ["-v"], 0, "Verbose output turned on")
275+
print_green(f"[PASS] Verbose flag works (-v)")
275276

276277
def test_abort_flag(self):
277278
"""Verify that that 9pm abort flag works (--abort)"""
278279

279280
self.run(["cases/fail.sh", "cases/pass.sh"], ["--abort"], 1, "Aborting execution")
281+
print_green(f"[PASS] Abort flag works (-a --abort)")
282+
283+
def test_proj_config(self):
284+
"""Verify that that 9pm project config works (--proj)"""
285+
286+
self.run(["cases/pass.sh"], ["-v"], 0, "Testing 9pm")
287+
288+
self.run(["cases/pass.sh"], ["-v", "--proj", "configs/proj-test1.yaml"], 0, "Testing Self Test 1")
289+
290+
self.env["NINEPM_PROJ_CONFIG"] = "configs/proj-test2.yaml"
291+
self.run(["cases/pass.sh"], ["-v"], 0, "Testing Self Test 2")
292+
# This shall have precedence over env
293+
self.run(["cases/pass.sh"], ["-v", "--proj", "configs/proj-test1.yaml"], 0, "Testing Self Test 1")
294+
del self.env["NINEPM_PROJ_CONFIG"]
295+
296+
print_green(f"[PASS] Project Config works")
280297

281298
def test_repeat_flag(self):
282299
"""Verify that -r (--repeat) works"""
@@ -339,6 +356,7 @@ def cleanup(self):
339356
tester.test_verbose_flag()
340357
tester.test_abort_flag()
341358
tester.test_repeat_flag()
359+
tester.test_proj_config()
342360
print_green("All tests passed.")
343361
finally:
344362
tester.cleanup()

0 commit comments

Comments
 (0)