[issue37411] testEnviron (test.test_wsgiref.HandlerTests) fails when environment variable X is set

Miro Hrončok report at bugs.python.org
Wed Jun 26 08:05:51 EDT 2019


New submission from Miro Hrončok <miro at hroncok.cz>:

In Fedora CI, we use the environment variable X to set tests to skip:

https://src.fedoraproject.org/tests/python/blob/bd3ec9505cd37d80fe47fbb8234928abcfc0c658/f/selftest/parallel.sh#_9 - lines 9 and 21

However, I'Ve realized that testEnviron (test.test_wsgiref.HandlerTests) fails.

Here's a reproducer:

$ python3.7 -m test test_wsgiref 
Run tests sequentially
0:00:00 load avg: 0.75 [1/1] test_wsgiref

== Tests result: SUCCESS ==

1 test OK.

Total duration: 77 ms
Tests result: SUCCESS


$ X=boom python3.7 -m test test_wsgiref 
Run tests sequentially
0:00:00 load avg: 0.71 [1/1] test_wsgiref
test test_wsgiref failed -- Traceback (most recent call last):
  File "/usr/lib64/python3.7/test/test_wsgiref.py", line 567, in testEnviron
    self.checkOSEnviron(h)
  File "/usr/lib64/python3.7/test/test_wsgiref.py", line 559, in checkOSEnviron
    self.assertEqual(env[k],v)
AssertionError: 'Y' != 'boom'
- Y
+ boom


test_wsgiref failed

== Tests result: FAILURE ==

1 test failed:
    test_wsgiref

Total duration: 73 ms
Tests result: FAILURE


I believe that such tests should not be so easily fooled - it should be properly isolated or a less common variable name should be used if that is not possible, such as PYTHON_TEST_WSGIREF_TMP instead of X.

----------
components: Tests
messages: 346605
nosy: hroncok, vstinner
priority: normal
severity: normal
status: open
title: testEnviron (test.test_wsgiref.HandlerTests) fails when environment variable X is set
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37411>
_______________________________________


More information about the Python-bugs-list mailing list