From 678dc89cc9b7a172845c8fb8e3e496343c718afe Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Thu, 28 Jan 2016 00:33:17 +0000 Subject: [PATCH] Changed main integration test to wait for both jobs to be completed before shutting down. --- TODO | 1 + vigil | 4 ++-- vigil_test.py | 10 +++++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 06ad5ec..5be2b2b 100644 --- a/TODO +++ b/TODO @@ -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 diff --git a/vigil b/vigil index 79bd6e0..e937264 100755 --- a/vigil +++ b/vigil @@ -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): diff --git a/vigil_test.py b/vigil_test.py index 3fb4a44..5b0b455 100755 --- a/vigil_test.py +++ b/vigil_test.py @@ -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")