Bring back data_dir attribute for tests

This commit is contained in:
Mikhail Gordeev 2020-04-20 18:55:00 +03:00
parent ae9fc14795
commit 4ba1296d06
2 changed files with 9 additions and 7 deletions

View File

@ -32,6 +32,8 @@ class CB:
def __init__(
self,
config,
*,
data_dir=None,
no_tests=False,
create_remote_dirs=False
) -> None:
@ -41,9 +43,12 @@ class CB:
self.no_tests = no_tests
self._create_remote_dirs = create_remote_dirs
if not data_dir:
data_dir = (Path(self.expand_path(os.getenv('XDG_DATA_HOME',
'~/.local/share')))
/ f'{PROG}')
else:
data_dir = Path(data_dir)
self.data_dir = data_dir
self.checksum_command = 'sha256sum'

View File

@ -22,13 +22,10 @@ class TestIntegrationImages(TestCase):
with ExitStack() as stack:
stack.enter_context(mock.patch('subprocess.call', Call()))
stack.enter_context(mock.patch.dict(
'os.environ',
{'XDG_DATA_HOME': cls.work_dir.as_posix()}
))
cloud_build = CB(
config='tests/test_integration_images.yaml',
data_dir=(cls.work_dir / 'cloud_build').as_posix(),
no_tests=True,
create_remote_dirs=True,
)