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.

classification
Title: on RHEL6 simple build fails with test_linux_constants (test.test_resource.ResourceTest)
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.4
process
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.

Files
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 https://github.com/python/cpython.git (no patches applied whatsoever, and the last commit is https://github.com/python/cpython/commit/650406fe7373f31b595b381d4f2f02065607386a) 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/test_resource.py", 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/test_locale.py 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)

Reference:
http://man7.org/conf/lca2006/Linux_2.6_changes/rlimit_5.html

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?

2.6.32-358.23.2.el6.i686
msg201333 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-10-26 10:27
This issue has been accidentally fixed by http://hg.python.org/cpython/rev/513da56d28de 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.
History
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