test/osbuild: use proper object in stage run test

Create a proper `ObjectStore.Object` to use as tree for the `run`
method of `Stage`, since that is what is also normally passed to
it from `Pipeline.run`. It prepares for a future where `Object`
is not just used as `os.PathLike`.
This commit is contained in:
Christian Kellner 2022-11-30 12:54:01 +01:00
parent baa547b5e9
commit d48f4eb4ff

View file

@ -40,16 +40,16 @@ class TestDescriptions(unittest.TestCase):
with tempfile.TemporaryDirectory() as tmpdir:
data = pathlib.Path(tmpdir, "data")
storedir = pathlib.Path(tmpdir, "store")
root = pathlib.Path("/")
runner = Runner(index.detect_host_runner())
monitor = NullMonitor(sys.stderr.fileno())
libdir = os.path.abspath(os.curdir)
store = ObjectStore(storedir)
data.mkdir()
res = stage.run(data, runner, root, store, monitor, libdir)
with ObjectStore(storedir) as store:
data = store.new(stage.id)
res = stage.run(data, runner, root, store, monitor, libdir)
self.assertEqual(res.success, True)
self.assertEqual(res.id, stage.id)