aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/merge/test_engine.py')
-rw-r--r--tests/merge/test_engine.py54
1 files changed, 25 insertions, 29 deletions
diff --git a/tests/merge/test_engine.py b/tests/merge/test_engine.py
index bbebb33a1..35421a4c8 100644
--- a/tests/merge/test_engine.py
+++ b/tests/merge/test_engine.py
@@ -9,7 +9,6 @@ from .util import fake_engine
class fake_pkg:
-
def __init__(self, contents, label=None):
self.label = label
self.contents = contents
@@ -44,17 +43,17 @@ class TestMergeEngineCsets:
return getattr(MergeEngine, target)(engine, engine.csets, *args)
def test_generate_offset_cset(self):
- engine = fake_engine(csets={"new_cset":self.simple_cset},
- offset='/')
+ engine = fake_engine(csets={"new_cset": self.simple_cset}, offset="/")
+
def run(engine, cset):
- return self.run_cset('generate_offset_cset', engine,
- lambda e, c:c[cset])
+ return self.run_cset("generate_offset_cset", engine, lambda e, c: c[cset])
- self.assertCsetEqual(self.simple_cset, run(engine, 'new_cset'))
- engine.offset = '/foon/'
- run(engine, 'new_cset')
- self.assertCsetEqual(self.simple_cset.insert_offset(engine.offset),
- run(engine, 'new_cset'))
+ self.assertCsetEqual(self.simple_cset, run(engine, "new_cset"))
+ engine.offset = "/foon/"
+ run(engine, "new_cset")
+ self.assertCsetEqual(
+ self.simple_cset.insert_offset(engine.offset), run(engine, "new_cset")
+ )
def test_get_pkg_contents(self):
new_cset = MergeEngine.get_pkg_contents(None, None, fake_pkg(self.simple_cset))
@@ -64,17 +63,15 @@ class TestMergeEngineCsets:
def test_get_remove_cset(self):
files = contentsSet(self.simple_cset.iterfiles(invert=True))
- engine = fake_engine(csets={'install':files,
- 'old_cset':self.simple_cset})
- self.assertCsetEqual(self.simple_cset.iterfiles(),
- self.run_cset('get_remove_cset', engine))
+ engine = fake_engine(csets={"install": files, "old_cset": self.simple_cset})
+ self.assertCsetEqual(
+ self.simple_cset.iterfiles(), self.run_cset("get_remove_cset", engine)
+ )
def test_get_replace_cset(self):
files = contentsSet(self.simple_cset.iterfiles(invert=True))
- engine = fake_engine(csets={'install':files,
- 'old_cset':self.simple_cset})
- self.assertCsetEqual(files,
- self.run_cset('get_replace_cset', engine))
+ engine = fake_engine(csets={"install": files, "old_cset": self.simple_cset})
+ self.assertCsetEqual(files, self.run_cset("get_replace_cset", engine))
def test_rewrite_awareness(self, tmp_path):
src = contentsSet(self.simple_cset)
@@ -82,11 +79,11 @@ class TestMergeEngineCsets:
trg = src.difference(["/usr/lib/donkey"])
trg.add(fsFile("/usr/lib64/donkey"))
trg = trg.insert_offset(str(tmp_path))
- (tmp_path / 'usr' / 'lib64').mkdir(parents=True)
- (tmp_path / 'usr' / 'lib').symlink_to("lib64")
+ (tmp_path / "usr" / "lib64").mkdir(parents=True)
+ (tmp_path / "usr" / "lib").symlink_to("lib64")
pkg = fake_pkg(src)
engine = MergeEngine.install(str(tmp_path), pkg, offset=str(tmp_path))
- result = engine.csets['resolved_install']
+ result = engine.csets["resolved_install"]
assert set(result.iterfiles()) == set(trg.iterfiles())
@pytest.mark.skip("contentset should handle this")
@@ -98,22 +95,21 @@ class TestMergeEngineCsets:
trg = trg.insert_offset(str(tmp_path))
pkg = fake_pkg(src)
engine = MergeEngine.install(str(tmp_path), pkg, offset=str(tmp_path))
- result = engine.csets['new_cset']
+ result = engine.csets["new_cset"]
assert set(result.iterfiles()) == set(trg.iterfiles())
def test_get_livefs_intersect_cset(self, tmp_path):
old_cset = self.simple_cset.insert_offset(str(tmp_path))
# have to add it; scan adds the root node
old_cset.add(fsDir(str(tmp_path)))
- (tmp_path / 'usr').mkdir()
- (tmp_path / 'usr' / 'dar').touch()
- (tmp_path / 'foon').touch()
+ (tmp_path / "usr").mkdir()
+ (tmp_path / "usr" / "dar").touch()
+ (tmp_path / "foon").touch()
# note that this *is* a sym in the cset; adding this specific
# check so that if the code differs, the test breaks, and the tests
# get updated (additionally, folks may not be aware of the potential)
- (tmp_path / 'broken-symlink').touch()
- engine = fake_engine(csets={'test':old_cset})
+ (tmp_path / "broken-symlink").touch()
+ engine = fake_engine(csets={"test": old_cset})
existent = livefs.scan(str(tmp_path))
- generated = self.run_cset('_get_livefs_intersect_cset', engine,
- 'test')
+ generated = self.run_cset("_get_livefs_intersect_cset", engine, "test")
assert generated == existent