summaryrefslogtreecommitdiff
path: root/psutil/tests/test_misc.py
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2017-04-28 01:12:23 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2017-04-28 01:12:23 +0200
commit5b2b8f6da7a5f902ce48dde4e1c4484e1c45df41 (patch)
tree346ad2fb5d28958c9fb0c06661bdb4d511974e51 /psutil/tests/test_misc.py
parentc930cc8be839236053837c65b7e9243c7daa41e3 (diff)
downloadpsutil-5b2b8f6da7a5f902ce48dde4e1c4484e1c45df41.tar.gz
refactor unicode tests
Diffstat (limited to 'psutil/tests/test_misc.py')
-rwxr-xr-xpsutil/tests/test_misc.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/psutil/tests/test_misc.py b/psutil/tests/test_misc.py
index 42ff3a4b..e5bd7a70 100755
--- a/psutil/tests/test_misc.py
+++ b/psutil/tests/test_misc.py
@@ -686,11 +686,11 @@ class TestProcessUtils(unittest.TestCase):
# ===================================================================
-@unittest.skipIf(ASCII_FS, "ASCII fs")
-class TestUnicodeFilesystemAPIS(unittest.TestCase):
+class _UnicodeFilesystemAPIS(unittest.TestCase):
"""
Make sure that fs-related APIs returning a string are able to
handle unicode, see: https://github.com/giampaolo/psutil/issues/655
+ This is a base class which is tested by the mixins below.
"""
funky_name = TESTFN_UNICODE
@@ -769,17 +769,17 @@ class TestUnicodeFilesystemAPIS(unittest.TestCase):
@unittest.skipIf(ASCII_FS, "ASCII fs")
-class TestInvalidUnicodeFilesystemAPIS(TestUnicodeFilesystemAPIS):
+class TestUnicodeFilesystemAPISMixin(_UnicodeFilesystemAPIS):
+ funky_name = TESTFN_UNICODE
+
+
+class TestInvalidUnicodeFilesystemAPISMixin(_UnicodeFilesystemAPIS):
"""Like above but uses an invalid UTF8 file name."""
- # XXX: maybe this doesn't work as intended and should be removed.
if PY3:
- uexe = (TESTFN.encode('utf8') + b"f\xc0\x80").decode(
- 'utf8', 'surrogateescape')
- udir = (TESTFN.encode('utf8') + b"d\xc0\x80").decode(
+ funky_name = (TESTFN.encode('utf8') + b"f\xc0\x80").decode(
'utf8', 'surrogateescape')
else:
- uexe = TESTFN + b"f\xc0\x80"
- udir = TESTFN + b"d\xc0\x80"
+ funky_name = TESTFN + b"f\xc0\x80"
class TestUnicodeNonFsAPIS(unittest.TestCase):