diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2020-02-14 01:13:43 +0100 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2020-02-14 01:13:43 +0100 |
commit | be6c868f12a7b7c3f0fe0ed5a01d3870567d45eb (patch) | |
tree | 1388bbddd7e7558e049684a1a92e870176f5471f | |
parent | 29b02fc1bc4f9018f06a876ca4aa03355dd271a7 (diff) | |
download | psutil-be6c868f12a7b7c3f0fe0ed5a01d3870567d45eb.tar.gz |
#1659: provide error message in case of bugged PYPY2 version
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | psutil/_compat.py | 12 | ||||
-rw-r--r-- | psutil/tests/test_unicode.py | 4 |
3 files changed, 13 insertions, 5 deletions
@@ -17,7 +17,7 @@ DEPS = \ pyperf \ requests \ setuptools \ - sphinx==2.2.2 \ + sphinx \ twine \ unittest2 \ virtualenv \ diff --git a/psutil/_compat.py b/psutil/_compat.py index bd8e99f9..a9371382 100644 --- a/psutil/_compat.py +++ b/psutil/_compat.py @@ -54,6 +54,8 @@ if PY3: else: # https://github.com/PythonCharmers/python-future/blob/exceptions/ # src/future/types/exceptions/pep3151.py + import platform + _singleton = object() def instance_checking_exception(base_exception=Exception): @@ -108,6 +110,16 @@ else: def FileExistsError(inst): return getattr(inst, 'errno', _singleton) == errno.EEXIST + if platform.python_implementation() != "CPython": + try: + raise OSError(errno.EEXIST, "perm") + except FileExistsError: + pass + except OSError: + raise RuntimeError( + "broken / incompatible Python implementation, see: " + "https://github.com/giampaolo/psutil/issues/1659") + # --- stdlib additions diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index 81a28807..3c1c4a39 100644 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -305,8 +305,6 @@ 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 @@ -324,8 +322,6 @@ 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 |