|
2 | 2 | import sys
|
3 | 3 | import unittest
|
4 | 4 | from test import support
|
5 |
| -from test.support import os_helper, import_helper |
| 5 | +from test.support import import_helper |
| 6 | +from test.support import os_helper |
6 | 7 | import time
|
7 | 8 |
|
8 | 9 | resource = import_helper.import_module('resource')
|
@@ -99,6 +100,7 @@ def test_fsize_toobig(self):
|
99 | 100 | except (OverflowError, ValueError):
|
100 | 101 | pass
|
101 | 102 |
|
| 103 | + @unittest.skipUnless(hasattr(resource, "getrusage"), "needs getrusage") |
102 | 104 | def test_getrusage(self):
|
103 | 105 | self.assertRaises(TypeError, resource.getrusage)
|
104 | 106 | self.assertRaises(TypeError, resource.getrusage, 42, 42)
|
@@ -140,7 +142,7 @@ def test_pagesize(self):
|
140 | 142 | self.assertIsInstance(pagesize, int)
|
141 | 143 | self.assertGreaterEqual(pagesize, 0)
|
142 | 144 |
|
143 |
| - @unittest.skipUnless(sys.platform == 'linux', 'test requires Linux') |
| 145 | + @unittest.skipUnless(sys.platform in ('linux', 'android'), 'Linux only') |
144 | 146 | def test_linux_constants(self):
|
145 | 147 | for attr in ['MSGQUEUE', 'NICE', 'RTPRIO', 'RTTIME', 'SIGPENDING']:
|
146 | 148 | with contextlib.suppress(AttributeError):
|
@@ -177,8 +179,5 @@ def __getitem__(self, key):
|
177 | 179 | limits)
|
178 | 180 |
|
179 | 181 |
|
180 |
| -def test_main(verbose=None): |
181 |
| - support.run_unittest(ResourceTest) |
182 |
| - |
183 | 182 | if __name__ == "__main__":
|
184 |
| - test_main() |
| 183 | + unittest.main() |
0 commit comments