Bug 1814392
Summary: | test_site is failing on an installed python3 | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Charalampos Stratakis <cstratak> | |
Component: | python3 | Assignee: | Charalampos Stratakis <cstratak> | |
Status: | CLOSED ERRATA | QA Contact: | Lukáš Zachar <lzachar> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 8.2 | CC: | mhroncok, pviktori, vstinner | |
Target Milestone: | rc | |||
Target Release: | 8.0 | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | python3-3.6.8-26.el8 | Doc Type: | No Doc Update | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1815643 1815645 (view as bug list) | Environment: | ||
Last Closed: | 2020-11-04 01:30:33 UTC | Type: | Bug | |
Regression: | --- | Mount Type: | --- | |
Documentation: | --- | CRM: | ||
Verified Versions: | Category: | --- | ||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
Cloudforms Team: | --- | Target Upstream Version: | ||
Embargoed: | ||||
Bug Depends On: | ||||
Bug Blocks: | 1815643, 1815645 |
Description
Charalampos Stratakis
2020-03-17 18:37:57 UTC
Also on Fedora 32: == CPython 3.8.2 (default, Feb 28 2020, 00:00:00) [GCC 10.0.1 20200216 (Red Hat 10.0.1-0.8)] == Linux-5.6.0-0.rc4.git0.1.fc32.x86_64-x86_64-with-glibc2.2.5 little-endian == cwd: /tmp/test_python_624537 == CPU count: 8 == encodings: locale=UTF-8, FS=utf-8 0:00:00 load avg: 1.66 Run tests sequentially 0:00:00 load avg: 1.66 [1/1] test_site test__getuserbase (test.test_site.HelperFunctionsTests) ... ok test_addpackage (test.test_site.HelperFunctionsTests) ... ok test_addpackage_import_bad_exec (test.test_site.HelperFunctionsTests) ... ok test_addpackage_import_bad_pth_file (test.test_site.HelperFunctionsTests) ... ok test_addpackage_import_bad_syntax (test.test_site.HelperFunctionsTests) ... ok test_addsitedir (test.test_site.HelperFunctionsTests) ... ok test_get_path (test.test_site.HelperFunctionsTests) ... ok test_getsitepackages (test.test_site.HelperFunctionsTests) ... ok test_getuserbase (test.test_site.HelperFunctionsTests) ... ok test_getusersitepackages (test.test_site.HelperFunctionsTests) ... ok test_init_pathinfo (test.test_site.HelperFunctionsTests) ... ok test_makepath (test.test_site.HelperFunctionsTests) ... ok test_no_home_directory (test.test_site.HelperFunctionsTests) ... ok test_s_option (test.test_site.HelperFunctionsTests) ... ok test_abs_paths (test.test_site.ImportSideEffectTests) ... ok test_abs_paths_cached_None (test.test_site.ImportSideEffectTests) Test for __cached__ is None. ... ok test_add_build_dir (test.test_site.ImportSideEffectTests) ... skipped 'test not implemented' test_aliasing_mbcs (test.test_site.ImportSideEffectTests) ... ok test_license_exists_at_url (test.test_site.ImportSideEffectTests) ... skipped "resource 'network' is not enabled" test_no_duplicate_paths (test.test_site.ImportSideEffectTests) ... ok test_setting_copyright (test.test_site.ImportSideEffectTests) ... ok test_setting_help (test.test_site.ImportSideEffectTests) ... ok test_setting_quit (test.test_site.ImportSideEffectTests) ... ok test_sitecustomize_executed (test.test_site.ImportSideEffectTests) ... ok test_startup_imports (test.test_site.StartupImportTests) ... FAIL test_startup_interactivehook (test.test_site.StartupImportTests) ... ok test_startup_interactivehook_isolated (test.test_site.StartupImportTests) ... ok test_startup_interactivehook_isolated_explicit (test.test_site.StartupImportTests) ... ok test_underpth_file (test.test_site._pthFileTests) ... skipped 'only supported on Windows' test_underpth_nosite_file (test.test_site._pthFileTests) ... skipped 'only supported on Windows' ====================================================================== FAIL: test_startup_imports (test.test_site.StartupImportTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib64/python3.8/test/test_site.py", line 542, in test_startup_imports self.assertFalse(modules.intersection(collection_mods), stderr) AssertionError: {'reprlib', 'functools', 'types', 'collections', 'heapq', 'keyword', 'operator'} is not false : import _frozen_importlib # frozen import _imp # builtin import '_thread' # <class '_frozen_importlib.BuiltinImporter'> import '_warnings' # <class '_frozen_importlib.BuiltinImporter'> import '_weakref' # <class '_frozen_importlib.BuiltinImporter'> import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'> import '_io' # <class '_frozen_importlib.BuiltinImporter'> import 'marshal' # <class '_frozen_importlib.BuiltinImporter'> import 'posix' # <class '_frozen_importlib.BuiltinImporter'> import _thread # previously loaded ('_thread') import '_thread' # <class '_frozen_importlib.BuiltinImporter'> import _weakref # previously loaded ('_weakref') import '_weakref' # <class '_frozen_importlib.BuiltinImporter'> # installing zipimport hook import 'time' # <class '_frozen_importlib.BuiltinImporter'> import 'zipimport' # <class '_frozen_importlib.FrozenImporter'> # installed zipimport hook # /usr/lib64/python3.8/encodings/__pycache__/__init__.cpython-38.pyc matches /usr/lib64/python3.8/encodings/__init__.py # code object from '/usr/lib64/python3.8/encodings/__pycache__/__init__.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/codecs.cpython-38.pyc matches /usr/lib64/python3.8/codecs.py # code object from '/usr/lib64/python3.8/__pycache__/codecs.cpython-38.pyc' import '_codecs' # <class '_frozen_importlib.BuiltinImporter'> import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5493d880> # /usr/lib64/python3.8/encodings/__pycache__/aliases.cpython-38.pyc matches /usr/lib64/python3.8/encodings/aliases.py # code object from '/usr/lib64/python3.8/encodings/__pycache__/aliases.cpython-38.pyc' import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548d8e50> import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5493d670> # /usr/lib64/python3.8/encodings/__pycache__/utf_8.cpython-38.pyc matches /usr/lib64/python3.8/encodings/utf_8.py # code object from '/usr/lib64/python3.8/encodings/__pycache__/utf_8.cpython-38.pyc' import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5493dac0> import '_signal' # <class '_frozen_importlib.BuiltinImporter'> # /usr/lib64/python3.8/encodings/__pycache__/latin_1.cpython-38.pyc matches /usr/lib64/python3.8/encodings/latin_1.py # code object from '/usr/lib64/python3.8/encodings/__pycache__/latin_1.cpython-38.pyc' import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548d8f40> # /usr/lib64/python3.8/__pycache__/io.cpython-38.pyc matches /usr/lib64/python3.8/io.py # code object from '/usr/lib64/python3.8/__pycache__/io.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/abc.cpython-38.pyc matches /usr/lib64/python3.8/abc.py # code object from '/usr/lib64/python3.8/__pycache__/abc.cpython-38.pyc' import '_abc' # <class '_frozen_importlib.BuiltinImporter'> import 'abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548f0430> import 'io' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548f0160> Python 3.8.2 (default, Feb 28 2020, 00:00:00) [GCC 10.0.1 20200216 (Red Hat 10.0.1-0.8)] on linux Type "help", "copyright", "credits" or "license" for more information. # /usr/lib64/python3.8/__pycache__/site.cpython-38.pyc matches /usr/lib64/python3.8/site.py # code object from '/usr/lib64/python3.8/__pycache__/site.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/os.cpython-38.pyc matches /usr/lib64/python3.8/os.py # code object from '/usr/lib64/python3.8/__pycache__/os.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/stat.cpython-38.pyc matches /usr/lib64/python3.8/stat.py # code object from '/usr/lib64/python3.8/__pycache__/stat.cpython-38.pyc' import '_stat' # <class '_frozen_importlib.BuiltinImporter'> import 'stat' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5488ed30> # /usr/lib64/python3.8/__pycache__/_collections_abc.cpython-38.pyc matches /usr/lib64/python3.8/_collections_abc.py # code object from '/usr/lib64/python3.8/__pycache__/_collections_abc.cpython-38.pyc' import '_collections_abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5488edc0> # /usr/lib64/python3.8/__pycache__/posixpath.cpython-38.pyc matches /usr/lib64/python3.8/posixpath.py # code object from '/usr/lib64/python3.8/__pycache__/posixpath.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/genericpath.cpython-38.pyc matches /usr/lib64/python3.8/genericpath.py # code object from '/usr/lib64/python3.8/__pycache__/genericpath.cpython-38.pyc' import 'genericpath' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548c4700> import 'posixpath' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5488ee50> import 'os' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d549014c0> # /usr/lib64/python3.8/__pycache__/_sitebuiltins.cpython-38.pyc matches /usr/lib64/python3.8/_sitebuiltins.py # code object from '/usr/lib64/python3.8/__pycache__/_sitebuiltins.cpython-38.pyc' import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54901d60> # /usr/lib64/python3.8/__pycache__/_bootlocale.cpython-38.pyc matches /usr/lib64/python3.8/_bootlocale.py # code object from '/usr/lib64/python3.8/__pycache__/_bootlocale.cpython-38.pyc' import '_locale' # <class '_frozen_importlib.BuiltinImporter'> import '_bootlocale' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548c4b50> # /usr/lib64/python3.8/__pycache__/types.cpython-38.pyc matches /usr/lib64/python3.8/types.py # code object from '/usr/lib64/python3.8/__pycache__/types.cpython-38.pyc' import 'types' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548c4df0> # /usr/lib64/python3.8/importlib/__pycache__/__init__.cpython-38.pyc matches /usr/lib64/python3.8/importlib/__init__.py # code object from '/usr/lib64/python3.8/importlib/__pycache__/__init__.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/warnings.cpython-38.pyc matches /usr/lib64/python3.8/warnings.py # code object from '/usr/lib64/python3.8/__pycache__/warnings.cpython-38.pyc' import 'warnings' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548429d0> import 'importlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54842640> # /usr/lib64/python3.8/importlib/__pycache__/util.cpython-38.pyc matches /usr/lib64/python3.8/importlib/util.py # code object from '/usr/lib64/python3.8/importlib/__pycache__/util.cpython-38.pyc' # /usr/lib64/python3.8/importlib/__pycache__/abc.cpython-38.pyc matches /usr/lib64/python3.8/importlib/abc.py # code object from '/usr/lib64/python3.8/importlib/__pycache__/abc.cpython-38.pyc' # /usr/lib64/python3.8/importlib/__pycache__/machinery.cpython-38.pyc matches /usr/lib64/python3.8/importlib/machinery.py # code object from '/usr/lib64/python3.8/importlib/__pycache__/machinery.cpython-38.pyc' import 'importlib.machinery' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54855250> import 'importlib.abc' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5484c550> # /usr/lib64/python3.8/__pycache__/contextlib.cpython-38.pyc matches /usr/lib64/python3.8/contextlib.py # code object from '/usr/lib64/python3.8/__pycache__/contextlib.cpython-38.pyc' # /usr/lib64/python3.8/collections/__pycache__/__init__.cpython-38.pyc matches /usr/lib64/python3.8/collections/__init__.py # code object from '/usr/lib64/python3.8/collections/__pycache__/__init__.cpython-38.pyc' # /usr/lib64/python3.8/__pycache__/operator.cpython-38.pyc matches /usr/lib64/python3.8/operator.py # code object from '/usr/lib64/python3.8/__pycache__/operator.cpython-38.pyc' import '_operator' # <class '_frozen_importlib.BuiltinImporter'> import 'operator' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54801760> # /usr/lib64/python3.8/__pycache__/keyword.cpython-38.pyc matches /usr/lib64/python3.8/keyword.py # code object from '/usr/lib64/python3.8/__pycache__/keyword.cpython-38.pyc' import 'keyword' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54801850> # /usr/lib64/python3.8/__pycache__/heapq.cpython-38.pyc matches /usr/lib64/python3.8/heapq.py # code object from '/usr/lib64/python3.8/__pycache__/heapq.cpython-38.pyc' # extension module '_heapq' loaded from '/usr/lib64/python3.8/lib-dynload/_heapq.cpython-38-x86_64-linux-gnu.so' # extension module '_heapq' executed from '/usr/lib64/python3.8/lib-dynload/_heapq.cpython-38-x86_64-linux-gnu.so' import '_heapq' # <_frozen_importlib_external.ExtensionFileLoader object at 0x7f4d548061c0> import 'heapq' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548019d0> import 'itertools' # <class '_frozen_importlib.BuiltinImporter'> # /usr/lib64/python3.8/__pycache__/reprlib.cpython-38.pyc matches /usr/lib64/python3.8/reprlib.py # code object from '/usr/lib64/python3.8/__pycache__/reprlib.cpython-38.pyc' import 'reprlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54801d60> import '_collections' # <class '_frozen_importlib.BuiltinImporter'> import 'collections' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54862940> # /usr/lib64/python3.8/__pycache__/functools.cpython-38.pyc matches /usr/lib64/python3.8/functools.py # code object from '/usr/lib64/python3.8/__pycache__/functools.cpython-38.pyc' import '_functools' # <class '_frozen_importlib.BuiltinImporter'> import 'functools' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54862af0> import 'contextlib' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d5484cc10> import 'importlib.util' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54842820> # possible namespace for /usr/lib64/python3.8/site-packages/mpl_toolkits # possible namespace for /usr/lib64/python3.8/site-packages/zope # possible namespace for /usr/lib/python3.8/site-packages/paste # /usr/lib/python3.8/site-packages/__pycache__/abrt_exception_handler3.cpython-38.pyc matches /usr/lib/python3.8/site-packages/abrt_exception_handler3.py # code object from '/usr/lib/python3.8/site-packages/__pycache__/abrt_exception_handler3.cpython-38.pyc' import 'abrt_exception_handler3' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d54862ca0> # possible namespace for /usr/lib/python3.8/site-packages/sphinxcontrib # possible namespace for /usr/lib/python3.8/site-packages/sphinxcontrib # destroy sphinxcontrib # possible namespace for /usr/lib/python3.8/site-packages/sphinxcontrib # destroy sphinxcontrib # possible namespace for /usr/lib/python3.8/site-packages/sphinxcontrib # destroy sphinxcontrib # possible namespace for /usr/lib/python3.8/site-packages/sphinxcontrib # destroy sphinxcontrib # possible namespace for /usr/lib/python3.8/site-packages/sphinxcontrib # destroy sphinxcontrib # possible namespace for /usr/lib/python3.8/site-packages/straight # possible namespace for /usr/lib/python3.8/site-packages/zope # destroy zope # possible namespace for /usr/lib64/python3.8/site-packages/zope # possible namespace for /usr/lib/python3.8/site-packages/zope import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x7f4d548f0d90> # clear sys.audit hooks # clear builtins._ # clear sys.path # clear sys.argv # clear sys.ps1 # clear sys.ps2 # clear sys.last_type # clear sys.last_value # clear sys.last_traceback # clear sys.path_hooks # clear sys.path_importer_cache # clear sys.meta_path # clear sys.__interactivehook__ # restore sys.stdin # restore sys.stdout # restore sys.stderr # cleanup[2] removing sys # cleanup[2] removing builtins # cleanup[2] removing _frozen_importlib # cleanup[2] removing _imp # cleanup[2] removing _warnings # cleanup[2] removing _frozen_importlib_external # cleanup[2] removing _io # cleanup[2] removing marshal # cleanup[2] removing posix # cleanup[2] removing _thread # cleanup[2] removing _weakref # cleanup[2] removing time # cleanup[2] removing zipimport # destroy zipimport # cleanup[2] removing _codecs # cleanup[2] removing codecs # cleanup[2] removing encodings.aliases # cleanup[2] removing encodings # destroy encodings # cleanup[2] removing encodings.utf_8 # cleanup[2] removing _signal # cleanup[2] removing __main__ # destroy __main__ # cleanup[2] removing encodings.latin_1 # cleanup[2] removing _abc # cleanup[2] removing abc # cleanup[2] removing io # cleanup[2] removing _stat # cleanup[2] removing stat # cleanup[2] removing _collections_abc # cleanup[2] removing genericpath # cleanup[2] removing posixpath # cleanup[2] removing os.path # cleanup[2] removing os # cleanup[2] removing _sitebuiltins # cleanup[2] removing _locale # cleanup[2] removing _bootlocale # destroy _bootlocale # cleanup[2] removing types # cleanup[2] removing importlib._bootstrap # cleanup[2] removing importlib._bootstrap_external # cleanup[2] removing warnings # cleanup[2] removing importlib # destroy importlib # cleanup[2] removing importlib.machinery # cleanup[2] removing importlib.abc # cleanup[2] removing _operator # cleanup[2] removing operator # destroy operator # cleanup[2] removing keyword # destroy keyword # cleanup[2] removing _heapq # cleanup[2] removing heapq # cleanup[2] removing itertools # cleanup[2] removing reprlib # destroy reprlib # cleanup[2] removing _collections # cleanup[2] removing collections # destroy collections # cleanup[2] removing _functools # cleanup[2] removing functools # cleanup[2] removing contextlib # destroy contextlib # cleanup[2] removing importlib.util # cleanup[2] removing mpl_toolkits # destroy mpl_toolkits # cleanup[2] removing zope # destroy zope # cleanup[2] removing paste # destroy paste # cleanup[2] removing abrt_exception_handler3 # destroy abrt_exception_handler3 # cleanup[2] removing sphinxcontrib # destroy sphinxcontrib # cleanup[2] removing straight # destroy straight # cleanup[2] removing site # destroy site # destroy time # destroy _signal # destroy _sitebuiltins # destroy io # destroy _locale # destroy importlib.util # destroy importlib.abc # destroy functools # destroy types # destroy importlib.machinery # destroy warnings # destroy _collections_abc # destroy heapq # destroy _operator # destroy _heapq # destroy itertools # destroy _collections # destroy _functools # cleanup[3] wiping importlib._bootstrap_external # cleanup[3] wiping importlib._bootstrap # destroy _frozen_importlib_external # cleanup[3] wiping os # destroy abc # destroy posixpath # cleanup[3] wiping genericpath # cleanup[3] wiping stat # cleanup[3] wiping _stat # destroy _stat # cleanup[3] wiping _abc # cleanup[3] wiping encodings.latin_1 # cleanup[3] wiping encodings.utf_8 # cleanup[3] wiping encodings.aliases # cleanup[3] wiping codecs # cleanup[3] wiping _codecs # cleanup[3] wiping _weakref # destroy _weakref # cleanup[3] wiping _thread # destroy _thread # cleanup[3] wiping posix # destroy posix # cleanup[3] wiping marshal # destroy marshal # cleanup[3] wiping _io # destroy io # cleanup[3] wiping _warnings # destroy _warnings # cleanup[3] wiping _imp # destroy _imp # cleanup[3] wiping _frozen_importlib # cleanup[3] wiping sys # cleanup[3] wiping builtins # destroy _abc # destroy os # destroy stat # destroy genericpath # destroy _frozen_importlib ---------------------------------------------------------------------- Ran 30 tests in 0.206s FAILED (failures=1, skipped=4) test_site failed == Tests result: FAILURE == 1 test failed: test_site Total duration: 243 ms Tests result: FAILURE The problem is not the Python package, but that the test is affected by .pth files installed by other packages and these .pth files modify the list of modules imported at Python startup. For example on a RHEL8 VM installed by 1minutetip, beaker-client is pre-installed and this package contains /usr/lib/python3.6/site-packages/beaker_client-27.2-py3.6-nspkg.pth. This file is always executed at Python startup even when python3 is run with python3 -I ("isolated" mode) and the .pth file imports multiple modules (sys, types, os, importlib.util, importlib.machinery, bkr). Example: # dnf install -y python3-test # python3 -m test.test_site (...) FAILED (failures=1, skipped=3) Removing beaker-client works around the issue: # dnf remove -y beaker-client # python3 -m test.test_site (...) OK (skipped=3) On RHEL8, you can search for .pth files with: # find /usr/lib/python3.6 -name "*.pth" # find /usr/lib64/python3.6 -name "*.pth" Since there is no way to ignore installed .pth files, I see no obvious way to fix the test. The workaround is to uninstall packages containing .pth files, or don't run tests when such .pth files are installed. I found a Python upstream issue: https://bugs.python.org/issue27807 I plan to propose a fix there. Tested the PR downstream and the test is skipped with "skipped 'found 1 .pth files in: /usr/lib/python3.6/site-packages'" I fixed https://bugs.python.org/issue27807 : I pushed changes into 3.7, 3.8 and master branches of upstream Python. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (Moderate: python3 security and bug fix update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2020:4433 |