summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-05-04 06:55:15 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-05-04 06:55:15 +0200
commitcdb1e714b2134f91e337e4e74146f5962291a972 (patch)
treeaeba4e54d11b2da31dad69d944dc597a13c96177
parent4b18e691d0e856e942291144e6637081f9b13679 (diff)
downloadpsutil-cdb1e714b2134f91e337e4e74146f5962291a972.tar.gz
try to minimize dll related test failures
-rw-r--r--psutil/tests/__init__.py16
-rw-r--r--psutil/tests/test_unicode.py1
2 files changed, 11 insertions, 6 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
index a1bd53a1..196278ca 100644
--- a/psutil/tests/__init__.py
+++ b/psutil/tests/__init__.py
@@ -967,13 +967,19 @@ def copyload_shared_lib(dst_prefix=TESTFILE_PREFIX):
dst = tempfile.mktemp(prefix=dst_prefix, suffix=ext)
libs = [x.path for x in psutil.Process().memory_maps()
if os.path.normcase(os.path.splitext(x.path)[1]) == ext]
- if WINDOWS:
- libs = [x for x in libs if 'python' in os.path.basename(x).lower()]
- src = random.choice(libs)
cfile = None
try:
- shutil.copyfile(src, dst)
- cfile = ctypes.CDLL(dst)
+ for x in range(10):
+ # ...because sometimes either copyfile() or ctypes fail
+ # for no apparent reason.
+ # https://travis-ci.org/giampaolo/psutil/jobs/228599944
+ try:
+ src = random.choice(libs)
+ shutil.copyfile(src, dst)
+ cfile = ctypes.CDLL(dst)
+ break
+ except Exception as exc:
+ print("%s - retry" % exc)
yield dst
finally:
if WINDOWS and cfile is not None:
diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py
index 47e8d15c..e2e69786 100644
--- a/psutil/tests/test_unicode.py
+++ b/psutil/tests/test_unicode.py
@@ -233,7 +233,6 @@ class _BaseFSAPIsTests(object):
psutil.disk_usage(self.funky_name)
@unittest.skipIf(not HAS_MEMORY_MAPS, "not supported")
- @unittest.skipIf(not PY3, "ctypes opens err msg box on Python 2")
def test_memory_maps(self):
# XXX: on Python 2, using ctypes.CDLL with a unicode path
# opens a message box which blocks the test run.