summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-02-21 12:45:52 +0100
committerGitHub <noreply@github.com>2020-02-21 12:45:52 +0100
commit544e9daa4f66a9f80d7bf6c7886d693ee42f0a13 (patch)
tree279570fd1ada9aed14004c4638a94634397887ed
parent567547fa3ba3f11ee4f2dc9e73d37a146fe49e1b (diff)
downloadpsutil-544e9daa4f66a9f80d7bf6c7886d693ee42f0a13.tar.gz
Fix detecting empty result in TestSystemAPIs.test_users() (#1699)
-rwxr-xr-xpsutil/tests/test_posix.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py
index a96b310f..d2c4bfb6 100755
--- a/psutil/tests/test_posix.py
+++ b/psutil/tests/test_posix.py
@@ -368,9 +368,9 @@ class TestSystemAPIs(unittest.TestCase):
@retry_on_failure()
def test_users(self):
out = sh("who")
- lines = out.split('\n')
- if not lines:
+ if not out.strip():
raise self.skipTest("no users on this system")
+ lines = out.split('\n')
users = [x.split()[0] for x in lines]
terminals = [x.split()[1] for x in lines]
self.assertEqual(len(users), len(psutil.users()))