From 287a9d328c0f0b99829eb360e7ff0520403d41aa Mon Sep 17 00:00:00 2001 From: Paul Gevers Date: Tue, 17 Oct 2017 10:17:34 +0200 Subject: [PATCH] os.path.join(options.unstable, 'autopkgtest') isn't writable in the Debian setup and we have options.state_dir already --- britney2/policies/autopkgtest.py | 7 +++---- tests/test_autopkgtest.py | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/britney2/policies/autopkgtest.py b/britney2/policies/autopkgtest.py index e8fdfae..fc3977c 100644 --- a/britney2/policies/autopkgtest.py +++ b/britney2/policies/autopkgtest.py @@ -62,11 +62,10 @@ class AutopkgtestPolicy(BasePolicy): def __init__(self, options, suite_info): super().__init__('autopkgtest', options, suite_info, {'unstable'}) - self.test_state_dir = os.path.join(options.unstable, 'autopkgtest') # tests requested in this and previous runs # trigger -> src -> [arch] self.pending_tests = None - self.pending_tests_file = os.path.join(self.test_state_dir, 'pending.json') + self.pending_tests_file = os.path.join(self.options.state_dir, 'pending.json') # results map: trigger -> src -> arch -> [passed, version, run_id] # - trigger is "source/version" of an unstable package that triggered @@ -81,7 +80,7 @@ class AutopkgtestPolicy(BasePolicy): if self.options.adt_shared_results_cache: self.results_cache_file = self.options.adt_shared_results_cache else: - self.results_cache_file = os.path.join(self.test_state_dir, 'results.cache') + self.results_cache_file = os.path.join(self.options.state_dir, 'results.cache') try: self.options.adt_ppas = self.options.adt_ppas.strip().split() @@ -106,7 +105,7 @@ class AutopkgtestPolicy(BasePolicy): def initialise(self, britney): super().initialise(britney) - os.makedirs(self.test_state_dir, exist_ok=True) + os.makedirs(self.options.state_dir, exist_ok=True) self.read_pending_tests() # read the cached results that we collected so far diff --git a/tests/test_autopkgtest.py b/tests/test_autopkgtest.py index 2f96bba..0c1c524 100755 --- a/tests/test_autopkgtest.py +++ b/tests/test_autopkgtest.py @@ -152,7 +152,7 @@ class T(TestBase): pass try: - with open(os.path.join(self.data.path, 'data/unstable/autopkgtest/pending.json')) as f: + with open(os.path.join(self.data.path, 'data/testing/state/pending.json')) as f: self.pending_requests = json.load(f) except IOError: self.pending_requests = None @@ -368,7 +368,7 @@ class T(TestBase): self.assertNotIn('Failure', out, out) # caches the results and triggers - with open(os.path.join(self.data.path, 'data/unstable/autopkgtest/results.cache')) as f: + with open(os.path.join(self.data.path, 'data/testing/state/results.cache')) as f: res = json.load(f) self.assertEqual(res['green/1']['green']['amd64'], [False, '1', '20150101_020000@']) @@ -1378,7 +1378,7 @@ class T(TestBase): self.do_test( [], {'lightgreen': (False, {'lightgreen/2': {'amd64': 'REGRESSION', 'i386': 'RUNNING'}})}) - with open(os.path.join(self.data.path, 'data/unstable/autopkgtest/results.cache')) as f: + with open(os.path.join(self.data.path, 'data/testing/state/results.cache')) as f: contents = f.read() self.assertNotIn('null', contents) self.assertNotIn('None', contents) @@ -2303,7 +2303,7 @@ class T(TestBase): ) # move and remember original contents - local_path = os.path.join(self.data.path, 'data/unstable/autopkgtest/results.cache') + local_path = os.path.join(self.data.path, 'data/testing/state/results.cache') shared_path = os.path.join(self.data.path, 'shared_results.cache') os.rename(local_path, shared_path) with open(shared_path) as f: