mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
Fix unit tests which modify the source tree. (#45763)
* Fix CNOS unit test log usage. * Use temp dir for Galaxy unit tests. * Write to temp files in interfaces_file unit test. * Fix log placement in netapp_e_ldap unit test.
This commit is contained in:
@@ -39,6 +39,9 @@ class TestGalaxy(unittest.TestCase):
|
||||
'''creating prerequisites for installing a role; setUpClass occurs ONCE whereas setUp occurs with every method tested.'''
|
||||
# class data for easy viewing: role_dir, role_tar, role_name, role_req, role_path
|
||||
|
||||
cls.temp_dir = tempfile.mkdtemp(prefix='ansible-test_galaxy-')
|
||||
os.chdir(cls.temp_dir)
|
||||
|
||||
if os.path.exists("./delete_me"):
|
||||
shutil.rmtree("./delete_me")
|
||||
|
||||
@@ -89,6 +92,9 @@ class TestGalaxy(unittest.TestCase):
|
||||
if os.path.isdir(cls.role_path):
|
||||
shutil.rmtree(cls.role_path)
|
||||
|
||||
os.chdir('/')
|
||||
shutil.rmtree(cls.temp_dir)
|
||||
|
||||
def setUp(self):
|
||||
self.default_args = ['ansible-galaxy']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user