diff --git a/tests/unit/test_disk_accountant.py b/tests/unit/test_disk_accountant.py index fc4389c13e..e12846d29b 100644 --- a/tests/unit/test_disk_accountant.py +++ b/tests/unit/test_disk_accountant.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +import fixtures import os import tempfile import time @@ -32,6 +33,10 @@ class FakeExecutor(object): class TestDiskAccountant(BaseTestCase): + def setUp(self): + super(TestDiskAccountant, self).setUp() + self.useFixture(fixtures.NestedTempfile()) + def test_disk_accountant(self): jobs_dir = tempfile.mkdtemp( dir=os.environ.get("ZUUL_TEST_ROOT", None)) diff --git a/tests/unit/test_encryption.py b/tests/unit/test_encryption.py index b424769408..0a5c0a4e96 100644 --- a/tests/unit/test_encryption.py +++ b/tests/unit/test_encryption.py @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. +import fixtures import os import subprocess import tempfile @@ -26,6 +27,10 @@ class TestEncryption(BaseTestCase): def setUp(self): super(TestEncryption, self).setUp() self.private, self.public = encryption.generate_rsa_keypair() + # Because we set delete to False when using NamedTemporaryFile below + # we need to stick our usage of temporary files in the NestedTempfile + # fixture ensuring everything gets cleaned up when it is done. + self.useFixture(fixtures.NestedTempfile()) def test_serialization(self): "Verify key serialization"