Skip to content

Commit

Permalink
#1040: add funky unicode test for memory_maps()
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 1, 2017
1 parent 17cb9c5 commit a3c1bc2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,8 @@ def test_memory_maps(self):
def test_memory_maps_lists_lib(self):
p = psutil.Process()
ext = ".so" if POSIX else ".dll"
old = [x.path for x in p.memory_maps() if x.path.endswith(ext)][0]
old = [x.path for x in p.memory_maps()
if os.path.normcase(x.path).endswith(ext)][0]
new = os.path.normcase(copyload_shared_lib(old))
newpaths = [os.path.normcase(x.path) for x in p.memory_maps()]
self.assertIn(new, newpaths)
Expand Down
15 changes: 14 additions & 1 deletion psutil/tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- Process.cwd()
- Process.environ()
- Process.exe()
- Process.memory_maps() (not tested)
- Process.memory_maps()
- Process.name()
- Process.open_files()
- Process.username() (not tested)
Expand Down Expand Up @@ -72,9 +72,11 @@
from psutil.tests import ASCII_FS
from psutil.tests import bind_unix_socket
from psutil.tests import chdir
from psutil.tests import copyload_shared_lib
from psutil.tests import create_exe
from psutil.tests import get_test_subprocess
from psutil.tests import HAS_ENVIRON
from psutil.tests import HAS_MEMORY_MAPS
from psutil.tests import reap_children
from psutil.tests import run_test_module_by_name
from psutil.tests import safe_mkdir
Expand Down Expand Up @@ -235,6 +237,17 @@ def test_disk_usage(self):
safe_mkdir(self.funky_name)
psutil.disk_usage(self.funky_name)

@unittest.skipIf(not HAS_MEMORY_MAPS, "not supported")
def test_memory_maps(self):
p = psutil.Process()
ext = ".so" if POSIX else ".dll"
old = [x.path for x in p.memory_maps()
if os.path.normcase(x.path).endswith(ext)][0]
new = os.path.normcase(
copyload_shared_lib(old, dst_prefix=self.funky_name))
newpaths = [os.path.normcase(x.path) for x in p.memory_maps()]
self.assertIn(new, newpaths)


@unittest.skipIf(OSX and TRAVIS, "unreliable on TRAVIS") # TODO
@unittest.skipIf(ASCII_FS, "ASCII fs")
Expand Down

0 comments on commit a3c1bc2

Please sign in to comment.