Commit 8875d74a authored by Brett Cannon's avatar Brett Cannon

test_resource should not assume all attributes are available when they

are individually controlled by #ifdef statements in the extension
code.
parent 8f29e187
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)
self.assertIsInstance(resource.RLIMIT_NICE, int)
self.assertIsInstance(resource.RLIMIT_RTPRIO, int)
self.assertIsInstance(resource.RLIMIT_RTTIME, int)
self.assertIsInstance(resource.RLIMIT_SIGPENDING, int)
for attr in ['MSGQUEUE', 'NICE', 'RTPRIO', 'RTTIME', 'SIGPENDING']:
with contextlib.suppress(AttributeError):
self.assertIsInstance(getattr(resource, 'RLIMIT_' + attr), int)
@unittest.skipUnless(hasattr(resource, 'prlimit'), 'no prlimit')
@support.requires_linux_version(2, 6, 36)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment