Skip to content

Commit

Permalink
fixup! add "store" to OSBuild test class
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Sep 11, 2024
1 parent 04711e3 commit d3128eb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion test/run/test_stages.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def test_run_stage_diff(tmp_path, osb, test_dir):
# cache the downloaded data for the sources by copying
# it to self.cache, which is going to be used to initialize
# the osbuild cache with.
osb.copy_source_data(osb.cache_from, "org.osbuild.files")
osb.copy_source_data(osb.store, "org.osbuild.files")


@unittest.skipUnless(test.TestBase.have_test_data(), "no test-data access")
Expand Down
6 changes: 2 additions & 4 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ class OSBuild(contextlib.AbstractContextManager):

def __init__(self, *, cache_from=None):
self._cache_from = cache_from
self.store = None

def __enter__(self):
self._exitstack = contextlib.ExitStack()
Expand Down Expand Up @@ -336,10 +337,6 @@ def __exit__(self, exc_type, exc_value, exc_tb):
self._cachedir = None
self._exitstack = None

@property
def cache_from(self) -> str:
return self._cache_from

@staticmethod
def _print_result(code, data_stdout, data_stderr, log):
print(f"osbuild failed with: {code}")
Expand Down Expand Up @@ -518,6 +515,7 @@ def osbuild_fixture():
store = tempfile.mkdtemp(prefix="osbuild-test-", dir="/var/tmp")
cleanup_dir = store
with OSBuild(cache_from=store) as osb:
osb.store = store
yield osb
if cleanup_dir:
shutil.rmtree(cleanup_dir)

0 comments on commit d3128eb

Please sign in to comment.