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
标题: on RHEL6 simple build fails with test_linux_constants (test.test_resource.ResourceTest)
类型: behavior Stage: resolved
Components: Tests Versions: Python 3.4
process
状态: closed Resolution: fixed
Dependencies: 后续:
分配给: brett.cannon 抄送列表: brett.cannon, christian.heimes, mcepl, skrah, vajrasky
优先级: normal 关键字: patch

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

文件
文件名 上传时间 Description 编辑
issue19353.patch christian.heimes, 2013-10-22 19:10 review
Messages (9)
msg200973 - (view) Author: Matej Cepl (mcepl) * 日期: 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) 日期: 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) 日期: 2013-10-22 18:43
What's the output of "uname -r" on your machine?
msg200981 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) 日期: 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) * 日期: 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) * 日期: 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) * 日期: 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) * 日期: 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) 日期: 2013-10-26 13:23
Since the test now passes I'm going to close this as fixed.
历史
日期 用户 动作 参数
2022-04-11 14:57:52admin修改github: 63552
2013-10-26 13:23:44brett.cannon修改状态: open -> closed
消息: + msg201353

assignee: brett.cannon
resolution: fixed
stage: patch review -> resolved
2013-10-26 10:27:35vajrasky修改抄送: + brett.cannon
消息: + msg201333
2013-10-23 05:50:19mcepl修改消息: + msg200998
2013-10-23 02:45:16vajrasky修改消息: + msg200994
2013-10-23 02:30:29vajrasky修改抄送: + vajrasky
消息: + msg200993
2013-10-22 19:10:15christian.heimes修改文件: + issue19353.patch

components: + Tests
versions: + Python 3.4
keywords: + patch
type: behavior
消息: + msg200981
stage: patch review
2013-10-22 18:43:50christian.heimes修改消息: + msg200979
2013-10-22 18:04:30skrah修改抄送: + skrah, christian.heimes
消息: + msg200977
2013-10-22 17:14:26mcepl创建