This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: on RHEL6 simple build fails with test_linux_constants (test.test_resource.ResourceTest)
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: brett.cannon Nosy List: brett.cannon, christian.heimes, mcepl, skrah, vajrasky
Priority: normal Keywords: patch

Created on 2013-10-22 17:14 by mcepl, last changed 2022-04-11 14:57 by admin. This issue is now closed.

File name Uploaded Description Edit
issue19353.patch christian.heimes, 2013-10-22 19:10 review
Messages (9)
msg200973 - (view) Author: Matej Cepl (mcepl) * Date: 2013-10-22 17:14
With pure clone of (no patches applied whatsoever, and the last commit is and pure

./configure && make -j2 && make -j2 test I get one failed test:

ERROR: test_linux_constants (test.test_resource.ResourceTest)
Traceback (most recent call last):
  File "/home/matej/Repos/cpython/Lib/test/", line 139, in test_linux_constants
    self.assertIsInstance(resource.RLIMIT_RTTIME, int)
AttributeError: 'module' object has no attribute 'RLIMIT_RTTIME'

Ran 9 tests in 0.468s

FAILED (errors=1, skipped=1)
test test_resource failed
make: *** [test] Error 1
msg200977 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-10-22 18:04
Christian, could you have a look? I think this was added in #19324.
msg200979 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-22 18:43
What's the output of "uname -r" on your machine?
msg200981 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-10-22 19:10
Patch with fix.

I'm checking the kernel version manually. requires_linux_version() works only per test. I don't want to write a test case for each attribute ...
msg200993 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-23 02:30
Do we really need to test these constants in unit test?

Other constants such as RLIMIT_STACK, RLIMIT_DATA, etc are not being tested. Other consideration includes people built custom kernel without these constants, or maybe they have outdated glibc.

Additionally, it is very uncommon to use os.uname in unittest. Other than this test, it is only Lib/test/ that uses os.uname.
msg200994 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-23 02:45
Or if we really want to test these constants, we can use something like this:

if hasattr(resource, 'RLIMIT_NICE'):
    self.assertIsInstance(resource.RLIMIT_NICE, int)

Or if we want to be so strict:

if hasattr(resource, 'RLIMIT_NICE'):
    self.assertTrue(-20 <= resource.RLIMIT_NICE <= 19)


RLIMIT_NICE (2.6.12)

    Process nice value has range -20 (high) to +19 (low); influences kernel scheduler.
msg200998 - (view) Author: Matej Cepl (mcepl) * Date: 2013-10-23 05:50
On 22/10/13 20:43, Christian Heimes wrote:
> Christian Heimes added the comment:
> What's the output of "uname -r" on your machine?

msg201333 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-26 10:27
This issue has been accidentally fixed by commit.

Time to close it? Any last words?
msg201353 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2013-10-26 13:23
Since the test now passes I'm going to close this as fixed.
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63552
2013-10-26 13:23:44brett.cannonsetstatus: open -> closed
messages: + msg201353

assignee: brett.cannon
resolution: fixed
stage: patch review -> resolved
2013-10-26 10:27:35vajraskysetnosy: + brett.cannon
messages: + msg201333
2013-10-23 05:50:19mceplsetmessages: + msg200998
2013-10-23 02:45:16vajraskysetmessages: + msg200994
2013-10-23 02:30:29vajraskysetnosy: + vajrasky
messages: + msg200993
2013-10-22 19:10:15christian.heimessetfiles: + issue19353.patch

components: + Tests
versions: + Python 3.4
keywords: + patch
type: behavior
messages: + msg200981
stage: patch review
2013-10-22 18:43:50christian.heimessetmessages: + msg200979
2013-10-22 18:04:30skrahsetnosy: + skrah, christian.heimes
messages: + msg200977
2013-10-22 17:14:26mceplcreate