mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-08 21:18:04 +03:00
tests: Clean up cli imports even if --skipcli passed
This commit is contained in:
parent
7664840e68
commit
623edd1a84
@ -14,6 +14,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
import atexit
|
||||
import imp
|
||||
import logging
|
||||
import os
|
||||
|
||||
@ -46,3 +48,22 @@ if utils.get_debug():
|
||||
rootLogger.setLevel(logging.DEBUG)
|
||||
else:
|
||||
rootLogger.setLevel(logging.ERROR)
|
||||
|
||||
_cleanup_imports = []
|
||||
|
||||
|
||||
def _import(name, path):
|
||||
_cleanup_imports.append(path + "c")
|
||||
return imp.load_source(name, path)
|
||||
|
||||
|
||||
def _cleanup_imports_cb():
|
||||
for f in _cleanup_imports:
|
||||
if os.path.exists(f):
|
||||
os.unlink(f)
|
||||
|
||||
atexit.register(_cleanup_imports_cb)
|
||||
virtinstall = _import("virtinstall", "virt-install")
|
||||
virtimage = _import("virtimage", "virt-image")
|
||||
virtclone = _import("virtclone", "virt-clone")
|
||||
virtconvert = _import("virtconvert", "virt-convert")
|
||||
|
@ -15,7 +15,6 @@
|
||||
# MA 02110-1301 USA.
|
||||
|
||||
import atexit
|
||||
import imp
|
||||
import logging
|
||||
import os
|
||||
import shlex
|
||||
@ -28,6 +27,7 @@ import StringIO
|
||||
|
||||
import virtinst.cli
|
||||
|
||||
from tests import virtinstall, virtimage, virtclone, virtconvert
|
||||
from tests import utils
|
||||
|
||||
os.environ["VIRTCONV_TEST_NO_DISK_CONVERSION"] = "1"
|
||||
@ -129,26 +129,6 @@ test_files = {
|
||||
}
|
||||
|
||||
|
||||
_cleanup_imports = []
|
||||
|
||||
|
||||
def _import(name, path):
|
||||
_cleanup_imports.append(path + "c")
|
||||
return imp.load_source(name, path)
|
||||
|
||||
|
||||
def _cleanup_imports_cb():
|
||||
for f in _cleanup_imports:
|
||||
if os.path.exists(f):
|
||||
os.unlink(f)
|
||||
|
||||
|
||||
atexit.register(_cleanup_imports_cb)
|
||||
virtinstall = _import("virtinstall", "virt-install")
|
||||
virtimage = _import("virtimage", "virt-image")
|
||||
virtclone = _import("virtclone", "virt-clone")
|
||||
virtconvert = _import("virtconvert", "virt-convert")
|
||||
|
||||
|
||||
######################
|
||||
# Test class helpers #
|
||||
|
Loading…
Reference in New Issue
Block a user