summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2016-10-18 01:56:43 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2016-10-18 01:56:43 +0200
commit0701e84fe78ae26b577ac009946df131d0f3be23 (patch)
treed281aaf9da97681abbb6a45141cb944fdfbd731b
parentd4e8ae4013c8c0f389cc946abe780254db2512b9 (diff)
downloadpsutil-0701e84fe78ae26b577ac009946df131d0f3be23.tar.gz
test refactroring
-rwxr-xr-xpsutil/tests/test_process.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py
index dc08a6a0..8849db06 100755
--- a/psutil/tests/test_process.py
+++ b/psutil/tests/test_process.py
@@ -1861,13 +1861,15 @@ if POSIX and os.getuid() == 0:
@unittest.skipIf(OSX and TRAVIS, "fails on OSX + TRAVIS")
class TestUnicode(unittest.TestCase):
- # See: https://github.com/giampaolo/psutil/issues/655
+ """
+ Make sure that APIs returning a string are able to handle unicode,
+ see: https://github.com/giampaolo/psutil/issues/655
+ """
@classmethod
def setUpClass(cls):
cls.uexe = create_temp_executable_file('è')
- cls.ubasename = os.path.basename(cls.uexe)
- assert 'è' in cls.ubasename
+ assert 'è' in os.path.basename(cls.uexe)
@classmethod
def tearDownClass(cls):
@@ -1883,7 +1885,8 @@ class TestUnicode(unittest.TestCase):
subp = get_test_subprocess(cmd=[self.uexe])
p = psutil.Process(subp.pid)
self.assertIsInstance(p.name(), str)
- self.assertEqual(os.path.basename(p.name()), self.ubasename)
+ self.assertEqual(os.path.basename(p.name()),
+ os.path.basename(self.uexe))
def test_proc_name(self):
subp = get_test_subprocess(cmd=[self.uexe])
@@ -1892,7 +1895,7 @@ class TestUnicode(unittest.TestCase):
name = py2_strencode(psutil._psplatform.cext.proc_name(subp.pid))
else:
name = psutil.Process(subp.pid).name()
- self.assertEqual(name, self.ubasename)
+ self.assertEqual(name, os.path.basename(self.uexe))
def test_proc_cmdline(self):
subp = get_test_subprocess(cmd=[self.uexe])