From 736dd3a701b375715a325897c41638a9de9fc52d Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Sun, 14 Feb 2016 00:32:12 +0000 Subject: [PATCH] Coding style. Finish moving _CACHE_PATH to tools. --- vigil | 9 +++------ worker_test.py | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/vigil b/vigil index 9d7d128..8c1aa6b 100755 --- a/vigil +++ b/vigil @@ -89,9 +89,6 @@ def _log_error(message=None): log_file.write(message) -_CACHE_PATH = tools._CACHE_PATH - - def reverse_style(style): return termstr.CharStyle(style.bg_color, style.fg_color, style.is_bold, style.is_underlined) @@ -439,7 +436,7 @@ class Log: GREY_BOLD_STYLE = termstr.CharStyle(termstr.Color.grey_100, is_bold=True) GREEN_STYLE = termstr.CharStyle(termstr.Color.green) - LOG_PATH = os.path.join(_CACHE_PATH, "log") + LOG_PATH = os.path.join(tools._CACHE_PATH, "log") def __init__(self, appearance_changed_event): self._appearance_changed_event = appearance_changed_event @@ -921,7 +918,7 @@ def main(root_path, worker_count=multiprocessing.cpu_count()*2, appearance_changed_event = threading.Event() is_first_run = True try: - pickle_path = os.path.join(_CACHE_PATH, "summary.pickle") + pickle_path = os.path.join(tools._CACHE_PATH, "summary.pickle") with gzip.open(pickle_path, "rb") as file_: screen = pickle.load(file_) except FileNotFoundError: @@ -1027,7 +1024,7 @@ def chdir(path): def manage_cache(root_path): - cache_path = os.path.join(root_path, _CACHE_PATH) + cache_path = os.path.join(root_path, tools._CACHE_PATH) timestamp_path = os.path.join(cache_path, "creation_time") if os.path.exists(cache_path) and \ os.stat(__file__).st_mtime > os.stat(timestamp_path).st_mtime: diff --git a/worker_test.py b/worker_test.py index 7d617dc..8ff7404 100755 --- a/worker_test.py +++ b/worker_test.py @@ -11,7 +11,6 @@ import unittest import sandbox_fs import tools -import vigil import worker @@ -21,7 +20,7 @@ class WorkerTestCase(unittest.TestCase): self.temp_dir = tempfile.mkdtemp() self.original_working_dir = os.getcwd() os.chdir(self.temp_dir) - os.mkdir(vigil._CACHE_PATH) + os.mkdir(tools._CACHE_PATH) open("foo", "w").close() def tearDown(self): @@ -31,7 +30,7 @@ class WorkerTestCase(unittest.TestCase): def _test_worker(self, sandbox): status = worker.Worker(sandbox).run_tool("foo", tools.metadata) self.assertEqual(status, tools.Status.normal) - result_path = os.path.join(vigil._CACHE_PATH, "foo-metadata") + result_path = os.path.join(tools._CACHE_PATH, "foo-metadata") self.assertTrue(os.path.exists(result_path)) def test_run_job_without_sandbox(self):