@@ -41,23 +41,26 @@ def test_relative_out_file(self):
4141
4242 def test_TMPDIR (self ):
4343 """Tests that the TMPDIR environment variable is respected"""
44- from tempfile import TemporaryDirectory
4544 from os import environ
45+ from tempfile import TemporaryDirectory
46+
4647 try :
4748 with TemporaryDirectory () as tmpdir :
4849 environ ["TMPDIR" ] = tmpdir
4950 generator = InitramfsGenerator (logger = self .logger , config = "tests/fullauto.toml" )
5051 generator .build ()
5152 self .assertTrue (Path (tmpdir ).exists ())
52- self .assertTrue ((Path (tmpdir ) / ' initramfs_test' / generator .out_file ).exists ())
53+ self .assertTrue ((Path (tmpdir ) / " initramfs_test" / generator .out_file ).exists ())
5354 except Exception as e :
5455 self .fail (f"Exception: { e } " )
5556 finally :
5657 environ .pop ("TMPDIR" )
5758
5859 def test_implied_relative_output (self ):
59- """ Tests implied relative output paths. Should resolve out_dir to the current dir. """
60- out_file = "implied/relative/path/initrd"
60+ """Tests implied relative output paths. Should resolve out_dir to the current dir."""
61+ from shutil import rmtree
62+ out_base_dir = str (uuid4 ())
63+ out_file = f"{ out_base_dir } /implied/relative/path/initrd"
6164 generator = InitramfsGenerator (logger = self .logger , config = "tests/fullauto.toml" , out_file = out_file )
6265 out_path = Path (out_file )
6366 if out_path .exists ():
@@ -68,8 +71,7 @@ def test_implied_relative_output(self):
6871 test_image = out_path .parent / generator ["test_rootfs_name" ]
6972 self .assertTrue (test_image .exists ())
7073 test_image .unlink ()
71- generator ["out_dir" ].rmdir ()
72-
74+ rmtree (out_base_dir )
7375
7476
7577if __name__ == "__main__" :
0 commit comments