diff options
| -rw-r--r-- | psutil/tests/__init__.py | 16 | ||||
| -rw-r--r-- | psutil/tests/test_unicode.py | 1 |
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. |
