summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-02-13 16:23:20 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2020-02-13 16:23:20 -0800
commit17843980f8edf665915f09cc9abfa3a32c322fbf (patch)
treea8d74ba7009347b686ea06de2a4ea4542ab1bba9
parentbe6c868f12a7b7c3f0fe0ed5a01d3870567d45eb (diff)
downloadpsutil-17843980f8edf665915f09cc9abfa3a32c322fbf.tar.gz
fix tests
-rw-r--r--psutil/tests/test_unicode.py4
-rwxr-xr-xpsutil/tests/test_windows.py4
2 files changed, 6 insertions, 2 deletions
diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py
index 3c1c4a39..81a28807 100644
--- a/psutil/tests/test_unicode.py
+++ b/psutil/tests/test_unicode.py
@@ -305,6 +305,8 @@ class _BaseFSAPIsTests(object):
@unittest.skipIf(PYPY and TRAVIS, "unreliable on PYPY + TRAVIS")
@unittest.skipIf(MACOS and TRAVIS, "unreliable on TRAVIS") # TODO
@unittest.skipIf(ASCII_FS, "ASCII fs")
+@unittest.skipIf(not subprocess_supports_unicode(TESTFN_UNICODE),
+ "subprocess can't deal with unicode")
class TestFSAPIs(_BaseFSAPIsTests, unittest.TestCase):
"""Test FS APIs with a funky, valid, UTF8 path name."""
funky_name = TESTFN_UNICODE
@@ -322,6 +324,8 @@ class TestFSAPIs(_BaseFSAPIsTests, unittest.TestCase):
@unittest.skipIf(PYPY and TRAVIS, "unreliable on PYPY + TRAVIS")
@unittest.skipIf(MACOS and TRAVIS, "unreliable on TRAVIS") # TODO
@unittest.skipIf(PYPY, "unreliable on PYPY")
+@unittest.skipIf(not subprocess_supports_unicode(INVALID_NAME),
+ "subprocess can't deal with invalid unicode")
class TestFSAPIsWithInvalidPath(_BaseFSAPIsTests, unittest.TestCase):
"""Test FS APIs with a funky, invalid path name."""
funky_name = INVALID_NAME
diff --git a/psutil/tests/test_windows.py b/psutil/tests/test_windows.py
index 8a93743f..934ea847 100755
--- a/psutil/tests/test_windows.py
+++ b/psutil/tests/test_windows.py
@@ -625,14 +625,14 @@ class TestDualProcessImplementation(TestCase):
def test_create_time(self):
ctime = psutil.Process(self.pid).create_time()
- with mock.patch("psutil._psplatform.cext.proc_create_time",
+ with mock.patch("psutil._psplatform.cext.proc_times",
side_effect=OSError(errno.EPERM, "msg")) as fun:
self.assertEqual(psutil.Process(self.pid).create_time(), ctime)
assert fun.called
def test_cpu_times(self):
cpu_times_1 = psutil.Process(self.pid).cpu_times()
- with mock.patch("psutil._psplatform.cext.proc_cpu_times",
+ with mock.patch("psutil._psplatform.cext.proc_times",
side_effect=OSError(errno.EPERM, "msg")) as fun:
cpu_times_2 = psutil.Process(self.pid).cpu_times()
assert fun.called