Coding style.
Finish moving _CACHE_PATH to tools.
This commit is contained in:
parent
5c75832efb
commit
736dd3a701
2 changed files with 5 additions and 9 deletions
9
vigil
9
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:
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue