mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +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:
@@ -21,6 +21,7 @@ __metaclass__ = type
|
||||
|
||||
import os
|
||||
import json
|
||||
import tempfile
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
from ansible.compat.tests.mock import patch
|
||||
@@ -59,6 +60,15 @@ class AnsibleFailJson(Exception):
|
||||
|
||||
|
||||
class TestCnosModule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
super(TestCnosModule, self).setUp()
|
||||
|
||||
self.test_log = tempfile.mkstemp(prefix='ansible-test-cnos-module-', suffix='.log')[1]
|
||||
|
||||
def tearDown(self):
|
||||
super(TestCnosModule, self).tearDown()
|
||||
|
||||
os.remove(self.test_log)
|
||||
|
||||
def execute_module(self, failed=False, changed=False, commands=None,
|
||||
sort=True, defaults=False):
|
||||
|
||||
Reference in New Issue
Block a user