tests: Don't overwrite mkstemp, just check environment
Since this can interfere with the initrdinject test
This commit is contained in:
parent
d9d50db522
commit
f431efc9b7
|
@ -35,13 +35,6 @@ from virtinst.cli import VirtOptionString
|
|||
_virtinst_uri_magic = "__virtinst_test__"
|
||||
|
||||
|
||||
def _fakemkstemp(prefix, *args, **kwargs):
|
||||
ignore = args
|
||||
ignore = kwargs
|
||||
filename = os.path.join(".", prefix)
|
||||
return os.open(filename, os.O_RDWR | os.O_CREAT), filename
|
||||
|
||||
|
||||
def _sanitize_xml(xml):
|
||||
import difflib
|
||||
|
||||
|
@ -411,8 +404,6 @@ class VirtualConnection(object):
|
|||
|
||||
if "predictable" in opts:
|
||||
opts.pop("predictable")
|
||||
import tempfile
|
||||
tempfile.mkstemp = _fakemkstemp
|
||||
setattr(self, "_virtinst__fake_conn_predictable", True)
|
||||
|
||||
# Fake remote status
|
||||
|
|
|
@ -63,8 +63,15 @@ class _ImageFetcher(object):
|
|||
def saveTemp(self, fileobj, prefix):
|
||||
if not os.path.exists(self.scratchdir):
|
||||
os.makedirs(self.scratchdir, 0750)
|
||||
(fd, fn) = tempfile.mkstemp(prefix="virtinst-" + prefix,
|
||||
dir=self.scratchdir)
|
||||
|
||||
prefix = "virtinst-" + prefix
|
||||
if "VIRTINST_TEST_SUITE" in os.environ:
|
||||
fn = os.path.join(".", prefix)
|
||||
fd = os.open(fn, os.O_RDWR | os.O_CREAT)
|
||||
else:
|
||||
(fd, fn) = tempfile.mkstemp(prefix=prefix,
|
||||
dir=self.scratchdir)
|
||||
|
||||
block_size = 16384
|
||||
try:
|
||||
while 1:
|
||||
|
|
Loading…
Reference in New Issue