diff options
Diffstat (limited to 'psutil/tests/test_posix.py')
-rwxr-xr-x | psutil/tests/test_posix.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py index 774c7f3c..d2631215 100755 --- a/psutil/tests/test_posix.py +++ b/psutil/tests/test_posix.py @@ -350,11 +350,13 @@ class TestSystemAPIs(PsutilTestCase): for idx, u in enumerate(psutil.users()): self.assertEqual(u.name, users[idx]) self.assertEqual(u.terminal, terminals[idx]) - p = psutil.Process(u.pid) - # on macOS time is off by ~47 secs for some reason, but - # the next test against 'who' CLI succeeds - delta = 60 if MACOS else 1 - self.assertAlmostEqual(u.started, p.create_time(), delta=delta) + if u.pid is not None: # None on OpenBSD + p = psutil.Process(u.pid) + # on macOS time is off by ~47 secs for some reason, but + # the next test against 'who' CLI succeeds + delta = 60 if MACOS else 1 + self.assertAlmostEqual( + u.started, p.create_time(), delta=delta) @retry_on_failure() def test_users_started(self): |