Make use of patch.stopall()

This commit is contained in:
Eric Torres 2019-04-17 11:53:05 -07:00
parent 3bbd2b2793
commit dbb5c0fa8b
5 changed files with 10 additions and 29 deletions

View File

@ -31,8 +31,7 @@ class TestMergeFiles(unittest.TestCase):
self.assertIsInstance(config.merge_files([]), Path) self.assertIsInstance(config.merge_files([]), Path)
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
self.patched_tempfile.stop()
class TestParseConfig(unittest.TestCase): class TestParseConfig(unittest.TestCase):
@ -54,6 +53,4 @@ class TestParseConfig(unittest.TestCase):
config.parse_configfile() config.parse_configfile()
def tearDown(self): def tearDown(self):
self.patched_config_file.stop() patch.stopall()
self.patched_path.stop()
self.patched_serialize.stop()

View File

@ -43,7 +43,7 @@ class TestHierarchyPaths(unittest.TestCase):
h._gen_metadata() h._gen_metadata()
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
class TestHierarchyMetadata(unittest.TestCase): class TestHierarchyMetadata(unittest.TestCase):
@ -123,6 +123,4 @@ class TestHierarchyCleanup(unittest.TestCase):
self.mocked_shutil.rmtree.assert_called_once() self.mocked_shutil.rmtree.assert_called_once()
def tearDown(self): def tearDown(self):
self.patched_metadata.stop() patch.stopall()
self.patched_path.stop()
self.patched_shutil.stop()

View File

@ -40,10 +40,7 @@ class TestCreatePackageManager(unittest.TestCase):
PackageManager("nothing", "nothing", l) PackageManager("nothing", "nothing", l)
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
self.patched_subprocess.stop()
self.patched_tarfile.stop()
self.patched_tempfile.stop()
class TestPackageManagerMethods(unittest.TestCase): class TestPackageManagerMethods(unittest.TestCase):
@ -110,7 +107,4 @@ class TestPackageManagerMethods(unittest.TestCase):
self.p.gen_db_archive(invalid_mode) self.p.gen_db_archive(invalid_mode)
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
self.patched_subprocess.stop()
self.patched_tarfile.stop()
self.patched_tempfile.stop()

View File

@ -100,9 +100,7 @@ class TestRepositoryPreCreate(unittest.TestCase):
self.assertTrue(all(isinstance(p, Snapshot) for p in repo)) self.assertTrue(all(isinstance(p, Snapshot) for p in repo))
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
self.patched_metadata.stop()
self.patched_snapshot.stop()
class TestRepositoryPostCreate(unittest.TestCase): class TestRepositoryPostCreate(unittest.TestCase):
@ -181,9 +179,7 @@ class TestRepositoryPostCreate(unittest.TestCase):
self.assertEqual(len(repo), 1) self.assertEqual(len(repo), 1)
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
self.patched_metadata.stop()
self.patched_snapshot.stop()
@unittest.skip("Fix call checks") @unittest.skip("Fix call checks")
@ -253,7 +249,4 @@ class TestRepositoryCleanup(unittest.TestCase):
self.mocked_shutil.rmtree.assert_called_once() self.mocked_shutil.rmtree.assert_called_once()
def tearDown(self): def tearDown(self):
self.patched_metadata.stop() patch.stopall()
self.patched_path.stop()
self.patched_shutil.stop()
self.patched_snapshot.stop()

View File

@ -34,5 +34,4 @@ class TestSnapshotProperties(unittest.TestCase):
self.assertIsInstance(Snapshot("/tmp/backup/snapshot").ctime, str) self.assertIsInstance(Snapshot("/tmp/backup/snapshot").ctime, str)
def tearDown(self): def tearDown(self):
self.patched_path.stop() patch.stopall()
self.patched_metadata.stop()