Changed main integration test to wait for both jobs to be completed before shutting down.

This commit is contained in:
Andrew Hamilton 2016-01-28 00:33:17 +00:00
parent 1f7fb7f6e4
commit 678dc89cc9
3 changed files with 12 additions and 3 deletions

1
TODO
View file

@ -14,6 +14,7 @@ Todo
- Cache tools._python_version.
- Determine if perl files are perl5 or perl6.
- Add bandit tool for python.
- Add page up and page down to the summary.
Done

4
vigil
View file

@ -850,8 +850,8 @@ class Runner:
summary.completed_total += 1
if summary.result_total == summary.completed_total:
log.log_message("All results are up to date.")
if self.is_being_tested and self.result.tool == tools.metadata:
os.kill(os.getpid(), signal.SIGINT)
if self.is_being_tested:
os.kill(os.getpid(), signal.SIGINT)
jobs_added_event.clear()
def pause(self):

View file

@ -11,6 +11,8 @@ import tempfile
import threading
import unittest
import psutil
import fill3
import golden
import vigil
@ -232,12 +234,17 @@ def _tmp_total():
return len(os.listdir("/tmp"))
def _all_processes():
return set(psutil.process_iter())
class MainTestCase(unittest.TestCase):
def test_main_and_restart_and_no_leaks_and_is_relocatable(self):
def test_run(root_path):
mount_total = _mount_total()
tmp_total = _tmp_total()
# processes = _all_processes()
foo_path = os.path.join(root_path, "foo")
open(foo_path, "w").close()
vigil.manage_cache(root_path)
@ -245,10 +252,11 @@ class MainTestCase(unittest.TestCase):
with contextlib.redirect_stdout(io.StringIO()):
vigil.main(root_path, is_being_tested=True)
for file_name in ["summary.pickle", "creation_time", "log",
"foo-metadata"]:
"foo-metadata", "foo-contents"]:
self.assertTrue(os.path.exists(".vigil/" + file_name))
self.assertEqual(_mount_total(), mount_total)
self.assertEqual(_tmp_total(), tmp_total)
# self.assertEqual(_all_processes(), processes) # Fix
temp_dir = tempfile.mkdtemp()
try:
first_dir = os.path.join(temp_dir, "first")