[4.6] Define create_module()/exec_module() in AssertionRewritingHook to avoid ImportWarning#8236
[4.6] Define create_module()/exec_module() in AssertionRewritingHook to avoid ImportWarning#8236hroncok wants to merge 1 commit intopytest-dev:4.6.xfrom
Conversation
hroncok
commented
Jan 11, 2021
…id ImportWarning
__________ ERROR collecting testing/python/show_fixtures_per_test.py ___________
/usr/lib/python3.10/site-packages/py/_path/local.py:704: in pyimport
__import__(modname)
<frozen importlib._bootstrap>:1026: in _find_and_load
???
<frozen importlib._bootstrap>:1005: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:681: in _load_unlocked
???
E ImportWarning: AssertionRewritingHook.exec_module() not found; falling back to load_module()
!!!!!!!!!!!!!!!!!!! Interrupted: 59 errors during collection !!!!!!!!!!!!!!!!!!!
=========================== 59 error in 3.65 seconds ===========================
4406319 to
b446caf
Compare
|
This might need some tests to be adapted thou :( |
|
It seems that the test is doing what it is supposed to do, but when the two new methods are added, it breaks. I have no idea how to proceed :( |
|
there's two competing import hook specifications, PEP302 (which is what pytest 4.6.x uses) and PEP 451 which is the new style imports. pytest moved to PEP 451 in pytest 5.0 when dropping python 2. the two PEPs are slightly incompatible with each other and python 2 dos not support PEP 451 so this isn't backportable I'd suggest ignoring the warning in python3.10 for now, and/or consider dropping pytest 4.6 and using a modern version instead the related bpo / PR are here: |
We have pytest 4.6 in Fedora only for pytest-relaxed (needed by invoke and paramiko). All other packages use pytest 6. |
|
See also bitprophet/pytest-relaxed#12 |