mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Use atexit for the cleanup
This commit is contained in:
parent
593544b577
commit
50c437f8c5
2 changed files with 8 additions and 12 deletions
|
@ -16,6 +16,7 @@ import errno
|
|||
import signal
|
||||
import shutil
|
||||
import pprint
|
||||
import atexit
|
||||
import logging
|
||||
import tempfile
|
||||
import subprocess
|
||||
|
@ -92,13 +93,16 @@ RUNTIME_CONFIGS = {}
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def cleanup_runtime_config_instance():
|
||||
def cleanup_runtime_config_instance(to_cleanup):
|
||||
# Explicit and forced cleanup
|
||||
for key in RUNTIME_CONFIGS.keys():
|
||||
instance = RUNTIME_CONFIGS.pop(key)
|
||||
for key in to_cleanup.keys():
|
||||
instance = to_cleanup.pop(key)
|
||||
del instance
|
||||
|
||||
|
||||
atexit.register(cleanup_runtime_config_instance, RUNTIME_CONFIGS)
|
||||
|
||||
|
||||
def run_tests(*test_cases, **kwargs):
|
||||
'''
|
||||
Run integration tests for the chosen test cases.
|
||||
|
@ -151,10 +155,6 @@ def run_tests(*test_cases, **kwargs):
|
|||
return SaltTestcaseParser.run_testcase(self, testcase)
|
||||
return SaltTestcaseParser.run_testcase(self, testcase)
|
||||
|
||||
def exit(self, status=0, msg=None):
|
||||
cleanup_runtime_config_instance()
|
||||
TestcaseParser.exit(self, status, msg)
|
||||
|
||||
parser = TestcaseParser()
|
||||
parser.parse_args()
|
||||
for case in test_cases:
|
||||
|
|
|
@ -13,7 +13,7 @@ import tempfile
|
|||
from integration import TestDaemon, TMP # pylint: disable=W0403
|
||||
|
||||
# Import Salt Testing libs
|
||||
from salttesting.parser import PNUM, print_header, cleanup_runtime_config_instance
|
||||
from salttesting.parser import PNUM, print_header
|
||||
from salttesting.parser.cover import SaltCoverageTestingParser
|
||||
|
||||
TEST_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
|
||||
|
@ -377,10 +377,6 @@ class SaltTestsuiteParser(SaltCoverageTestingParser):
|
|||
status.append(results)
|
||||
return status
|
||||
|
||||
def exit(self, status=0, msg=None):
|
||||
cleanup_runtime_config_instane()
|
||||
SaltTestsuiteParser.exit(self, status, msg)
|
||||
|
||||
|
||||
def main():
|
||||
'''
|
||||
|
|
Loading…
Add table
Reference in a new issue