def test_stage(self): name = "org.osbuild.test" options = {"one": 1} cases = [ (osbuild.Stage(name, {}, None, None, {}), {"name": name}), (osbuild.Stage(name, {}, None, None, None), {"name": name}), (osbuild.Stage(name, {}, None, None, options), {"name": name, "options": options}), ] for stage, description in cases: with self.subTest(description): self.assertEqual(stage.description(), description)
def test_stage_run(self): stage = osbuild.Stage("org.osbuild.noop", {}, None, None, {}) with tempfile.TemporaryDirectory() as tmpdir: data = pathlib.Path(tmpdir, "data") cache = pathlib.Path(tmpdir, "cache") root = pathlib.Path("/") runner = "org.osbuild.linux" monitor = NullMonitor(sys.stderr.fileno()) libdir = os.path.abspath(os.curdir) for p in [data, cache]: p.mkdir() res = stage.run(data, runner, root, cache, monitor, libdir) self.assertEqual(res.success, True) self.assertEqual(res.id, stage.id)
def test_stage_run(self): index = osbuild.meta.Index(os.curdir) info = index.get_module_info("Stage", "org.osbuild.noop") stage = osbuild.Stage(info, {}, None, None, {}) with tempfile.TemporaryDirectory() as tmpdir: data = pathlib.Path(tmpdir, "data") storedir = pathlib.Path(tmpdir, "store") root = pathlib.Path("/") runner = 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) self.assertEqual(res.success, True) self.assertEqual(res.id, stage.id)