tests: remove custom tmpdir() fixtures and use tmp_path

This commit removes some unnecessary custom tmpdir() fixtures
and uses the pytest buildin tmp_path instead.

Some custom tmpdir fixtures are left in place as they configure
the tmp location to be under `/var/tmp` which is not trivial to
do with pytests `tmp_path`. Not sure or not if the is a deep
reason there for using /var/tmp. I assume it's to ensure that
the tests run on a real FS not on a potential tmpfs but I don't
have the full background so didn't want to change anything.
This commit is contained in:
Michael Vogt 2023-11-23 10:42:50 +01:00 committed by Simon de Vlieger
parent d66b2faa41
commit 1374faa488
5 changed files with 37 additions and 67 deletions

View file

@ -37,12 +37,6 @@ def jsondata_fixture():
})
@pytest.fixture(name="tmpdir", scope="module")
def tmpdir_fixture():
with tempfile.TemporaryDirectory() as tmp:
yield tmp
@pytest.fixture(name="osb", scope="module")
def osbuild_fixture():
with test.OSBuild() as osb:
@ -69,5 +63,5 @@ def test_noop2(osb):
@pytest.mark.skipif(not test.TestBase.can_bind_mount(), reason="root-only")
def test_noop_v2(osb, tmpdir, jsondata):
osb.compile(jsondata, output_dir=tmpdir, exports=["noop"])
def test_noop_v2(osb, tmp_path, jsondata):
osb.compile(jsondata, output_dir=tmp_path, exports=["noop"])