summaryrefslogtreecommitdiff
path: root/psutil
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2023-04-20 00:22:49 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2023-04-20 00:22:49 +0200
commit3287ea328f76da7e5ff6cc148fdbd5afe33099dd (patch)
tree1218cdc2e88c4f1594ba2368b6db802f158eb8e0 /psutil
parent7389b4874d5685daa869eff6166dda7491a6ab10 (diff)
downloadpsutil-3287ea328f76da7e5ff6cc148fdbd5afe33099dd.tar.gz
fix failing users() test; update HISTORY; give CREDITS to @0-wiz-0 for #2241
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
Diffstat (limited to 'psutil')
-rwxr-xr-xpsutil/tests/test_posix.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/psutil/tests/test_posix.py b/psutil/tests/test_posix.py
index 8ea6cf7c..9ce82cae 100755
--- a/psutil/tests/test_posix.py
+++ b/psutil/tests/test_posix.py
@@ -358,6 +358,7 @@ class TestSystemAPIs(PsutilTestCase):
out = sh("who -u")
if not out.strip():
raise self.skipTest("no users on this system")
+ tstamp = None
# '2023-04-11 09:31' (Linux)
started = re.findall(r"\d\d\d\d-\d\d-\d\d \d\d:\d\d", out)
if started:
@@ -368,8 +369,14 @@ class TestSystemAPIs(PsutilTestCase):
if started:
tstamp = "%b %d %H:%M"
else:
- raise ValueError(
- "cannot interpret tstamp in who output\n%s" % (out))
+ # 'Apr 10'
+ started = re.findall(r"[A-Z][a-z][a-z] \d\d", out)
+ if started:
+ tstamp = "%b %d"
+
+ if not tstamp:
+ raise ValueError(
+ "cannot interpret tstamp in who output\n%s" % (out))
with self.subTest(psutil=psutil.users(), who=out):
for idx, u in enumerate(psutil.users()):
psutil_value = datetime.datetime.fromtimestamp(