From faa64435370e922ed2d5cb22e0479b4f1cb986a0 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:24:40 +0300 Subject: [PATCH 1/2] Update resource from 3.13.5 --- Lib/test/test_resource.py | 12 ++++++------ stdlib/src/resource.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 103d0199d09..429639d6aa7 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -2,7 +2,8 @@ import sys import unittest from test import support -from test.support import os_helper, import_helper +from test.support import import_helper +from test.support import os_helper import time resource = import_helper.import_module('resource') @@ -99,6 +100,7 @@ def test_fsize_toobig(self): except (OverflowError, ValueError): pass + @unittest.skipUnless(hasattr(resource, "getrusage"), "needs getrusage") def test_getrusage(self): self.assertRaises(TypeError, resource.getrusage) self.assertRaises(TypeError, resource.getrusage, 42, 42) @@ -133,6 +135,7 @@ def __getitem__(self, key): resource.setrlimit(resource.RLIMIT_CPU, BadSequence()) + # TODO: RUSTPYTHON: module 'resource' has no attribute 'getpagesize' @unittest.expectedFailure def test_pagesize(self): @@ -140,7 +143,7 @@ def test_pagesize(self): self.assertIsInstance(pagesize, int) self.assertGreaterEqual(pagesize, 0) - @unittest.skipUnless(sys.platform == 'linux', 'test requires Linux') + @unittest.skipUnless(sys.platform in ('linux', 'android'), 'Linux only') def test_linux_constants(self): for attr in ['MSGQUEUE', 'NICE', 'RTPRIO', 'RTTIME', 'SIGPENDING']: with contextlib.suppress(AttributeError): @@ -177,8 +180,5 @@ def __getitem__(self, key): limits) -def test_main(verbose=None): - support.run_unittest(ResourceTest) - if __name__ == "__main__": - test_main() + unittest.main() diff --git a/stdlib/src/resource.rs b/stdlib/src/resource.rs index a45d024b6c2..fdd9afcfbbd 100644 --- a/stdlib/src/resource.rs +++ b/stdlib/src/resource.rs @@ -92,7 +92,7 @@ mod resource { let tv = |tv: libc::timeval| tv.tv_sec as f64 + (tv.tv_usec as f64 / 1_000_000.0); Rusage { ru_utime: tv(rusage.ru_utime), - ru_stime: tv(rusage.ru_utime), + ru_stime: tv(rusage.ru_stime), ru_maxrss: rusage.ru_maxrss, ru_ixrss: rusage.ru_ixrss, ru_idrss: rusage.ru_idrss, From 2893e290521a95d59db4e8c07982fff1eb5b7511 Mon Sep 17 00:00:00 2001 From: ShaharNaveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Thu, 3 Jul 2025 19:27:30 +0300 Subject: [PATCH 2/2] Remove extra newline --- Lib/test/test_resource.py | 1 - 1 file changed, 1 deletion(-) diff --git a/Lib/test/test_resource.py b/Lib/test/test_resource.py index 429639d6aa7..d7ff492d0f7 100644 --- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -135,7 +135,6 @@ def __getitem__(self, key): resource.setrlimit(resource.RLIMIT_CPU, BadSequence()) - # TODO: RUSTPYTHON: module 'resource' has no attribute 'getpagesize' @unittest.expectedFailure def test_pagesize(self):