diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-05 21:51:19 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2017-05-05 21:51:19 +0200 |
commit | 51cb38be57ff5e4b19a47e36343e3e5006e618e4 (patch) | |
tree | b5ed5dca6519608a2f306b4617b72e1f130969ec | |
parent | 094eeb53d759884f87abebf9f19c49e2f19aa7ae (diff) | |
parent | d9dc82a379e14f34fa556d5fc8a0b5a8aa37988e (diff) | |
download | psutil-51cb38be57ff5e4b19a47e36343e3e5006e618e4.tar.gz |
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r-- | psutil/tests/__init__.py | 13 | ||||
-rwxr-xr-x | scripts/internal/winmake.py | 2 |
2 files changed, 11 insertions, 4 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 84215259..c03daf7f 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -12,7 +12,6 @@ from __future__ import print_function import atexit import contextlib -import ctypes import errno import functools import os @@ -688,8 +687,8 @@ def skip_on_not_implemented(only_if=None): def cleanup(): - for name in os.listdir('.'): - if name.startswith(TESTFILE_PREFIX): + for name in os.listdir(u('.')): + if name.startswith(u(TESTFILE_PREFIX)): try: safe_rmpath(name) except UnicodeEncodeError as exc: @@ -965,6 +964,7 @@ def copyload_shared_lib(dst_prefix=TESTFILE_PREFIX): in memory via ctypes. Return the new absolutized, normcased path. """ + import ctypes ext = ".so" if POSIX else ".dll" dst = tempfile.mktemp(prefix=dst_prefix, suffix=ext) libs = [x.path for x in psutil.Process().memory_maps() @@ -981,5 +981,12 @@ def copyload_shared_lib(dst_prefix=TESTFILE_PREFIX): yield dst finally: if WINDOWS and cfile is not None: + # See: + # - https://ci.appveyor.com/project/giampaolo/psutil/build/1207/ + # job/o53330pbnri9bcw7 + # - http://bugs.python.org/issue30286 + # - http://stackoverflow.com/questions/23522055 + from ctypes import wintypes + ctypes.windll.kernel32.FreeLibrary.argtypes = [wintypes.HMODULE] ctypes.windll.kernel32.FreeLibrary(cfile._handle) safe_rmpath(dst) diff --git a/scripts/internal/winmake.py b/scripts/internal/winmake.py index e3ac1e28..0408b80c 100755 --- a/scripts/internal/winmake.py +++ b/scripts/internal/winmake.py @@ -158,7 +158,7 @@ def safe_rmtree(path): def recursive_rm(*patterns): """Recursively remove a file or matching a list of patterns.""" - for root, subdirs, subfiles in os.walk('.'): + for root, subdirs, subfiles in os.walk(u'.'): root = os.path.normpath(root) if root.startswith('.git/'): continue |