change API to pass directory containing status file

Instead of passing the root directory, pass deliverables directory
like we do for the Deliverables class.

Change-Id: I3f6dfe8936ccbce62d0735c591694b8831604437
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-04-20 15:52:26 -04:00
parent 1fa2a5bdb8
commit 9bb5fec5f8
2 changed files with 3 additions and 5 deletions

View File

@ -74,11 +74,11 @@ class SeriesStatus(collections.abc.Mapping):
def default(cls):
module_path = os.path.dirname(__file__)
root_dir = os.path.dirname(module_path)
return cls.from_directory(root_dir)
return cls.from_directory(os.path.join(root_dir, 'deliverables'))
@staticmethod
def _load_series_status_data(root_dir):
filename = os.path.join(root_dir, 'deliverables', 'series_status.yaml')
filename = os.path.join(root_dir, 'series_status.yaml')
with open(filename, 'r', encoding='utf-8') as f:
return yamlutils.loads(f.read())

View File

@ -44,9 +44,7 @@ class TestConstructSeriesStatus(base.BaseTestCase):
def setUp(self):
super().setUp()
self.tmpdir = self.useFixture(fixtures.TempDir()).path
deliv_dir = os.path.join(self.tmpdir, 'deliverables')
os.mkdir(deliv_dir)
with open(os.path.join(deliv_dir, 'series_status.yaml'),
with open(os.path.join(self.tmpdir, 'series_status.yaml'),
'w', encoding='utf-8') as f:
f.write(self._body)