cpython: 513da56d28de (original) (raw)
Mercurial > cpython
changeset 86635:513da56d28de
test_resource should not assume all attributes are available when they are individually controlled by #ifdef statements in the extension code.
Brett Cannon brett@python.org | |
---|---|
date | Fri, 25 Oct 2013 15:45:25 -0400 |
parents | f3d50720dee0 |
children | 315bf54f5419 |
files | Lib/test/test_resource.py |
diffstat | 1 files changed, 4 insertions(+), 6 deletions(-)[+] [-] Lib/test/test_resource.py 10 |
line wrap: on
line diff
--- a/Lib/test/test_resource.py +++ b/Lib/test/test_resource.py @@ -1,3 +1,4 @@ +import contextlib import sys import os import unittest @@ -133,12 +134,9 @@ class ResourceTest(unittest.TestCase): @unittest.skipUnless(sys.platform == 'linux', 'test requires Linux') def test_linux_constants(self):
self.assertIsInstance(resource.RLIMIT_MSGQUEUE, int)[](#l1.12)
self.assertIsInstance(resource.RLIMIT_NICE, int)[](#l1.13)
self.assertIsInstance(resource.RLIMIT_RTPRIO, int)[](#l1.14)
self.assertIsInstance(resource.RLIMIT_RTTIME, int)[](#l1.15)
self.assertIsInstance(resource.RLIMIT_SIGPENDING, int)[](#l1.16)
for attr in ['MSGQUEUE', 'NICE', 'RTPRIO', 'RTTIME', 'SIGPENDING']:[](#l1.18)
with contextlib.suppress(AttributeError):[](#l1.19)
self.assertIsInstance(getattr(resource, 'RLIMIT_' + attr), int)[](#l1.20)
@unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit') @support.requires_linux_version(2, 6, 36)