Skip to content

Commit

Permalink
#1058: ignore unicode warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed May 10, 2017
1 parent 9e5c3b0 commit 4823c3a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion psutil/tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"""

import os
import warnings
from contextlib import closing

from psutil import BSD
Expand All @@ -61,6 +62,7 @@
from psutil import POSIX
from psutil import WINDOWS
from psutil._compat import PY3
from psutil._compat import u
from psutil.tests import ASCII_FS
from psutil.tests import bind_unix_socket
from psutil.tests import chdir
Expand Down Expand Up @@ -264,7 +266,13 @@ class TestFSAPIs(_BaseFSAPIsTests, unittest.TestCase):
def expect_exact_path_match(cls):
# Do not expect psutil to correctly handle unicode paths on
# Python 2 if os.listdir() is not able either.
return PY3 or cls.funky_name in os.listdir('.')
if PY3:
return True
else:
here = '.' if isinstance(cls.funky_name, str) else u('.')
with warnings.catch_warnings():
warnings.simplefilter("ignore")
return cls.funky_name in os.listdir(here)


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

0 comments on commit 4823c3a

Please sign in to comment.