-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanism
Description
When running ipytest.main
multiple times inside the same python process, the rewrite warning ("Module already imported so cannot be rewritten:" ...) is trigged for plugins. A minimal example is:
pip install pytest pytest_asyncio
import pytest
pytest.main()
pytest.main()
My real use case is: I'm using ipytest (I'm also the author) to run tests inside jupyter notebooks with pytest. Internally, ipytest
calls pytest.main
. Hence, the rewrite warnings are triggered. The pytest_asyncio
plugin is just an example, previously I observed the same behavior with the nbval
plugin.
I'm running pytest==4.2.6
on OSX 10.13.6. The packages are:
Package Version Location
------------------ -------- ----------------------------------------
aiohttp 3.5.4
appnope 0.1.0
async-timeout 3.0.1
atomicwrites 1.3.0
attrs 19.1.0
backcall 0.1.0
bleach 3.1.0
certifi 2019.3.9
chardet 3.0.4
commonmark 0.9.0
decorator 4.4.0
defusedxml 0.6.0
entrypoints 0.3
future 0.17.1
idna 2.8
importlib-metadata 0.17
ipykernel 5.1.1
ipytest 0.6.0
ipython 7.5.0
ipython-genutils 0.2.0
ipywidgets 7.4.2
jedi 0.13.3
Jinja2 2.10.1
jsonschema 3.0.1
jupyter 1.0.0
jupyter-client 5.2.4
jupyter-console 6.0.0
jupyter-core 4.4.0
keyring 19.0.2
MarkupSafe 1.1.1
mistletoe 0.7.2
mistune 0.8.4
more-itertools 7.0.0
multidict 4.5.2
nbconvert 5.5.0
nbformat 4.4.0
notebook 5.7.8
packaging 19.0
pandocfilters 1.4.2
parso 0.4.0
pexpect 4.7.0
pickleshare 0.7.5
pip 19.1.1
pluggy 0.12.0
prometheus-client 0.7.0
prompt-toolkit 2.0.9
ptyprocess 0.6.0
py 1.8.0
Pygments 2.4.2
pyparsing 2.4.0
pyrsistent 0.15.2
pytest 4.6.2
pytest-asyncio 0.10.0
python-dateutil 2.8.0
pyzmq 18.0.1
qtconsole 4.5.1
requests 2.22.0
Send2Trash 1.5.0
setuptools 41.0.1
six 1.12.0
terminado 0.8.2
testpath 0.4.2
tornado 6.0.2
traitlets 4.3.2
urllib3 1.25.3
wcwidth 0.1.7
webencodings 0.5.1
wheel 0.33.4
widgetsnbextension 3.4.2
yarl 1.3.0
zipp 0.5.1
Checklist:
- a detailed description of the bug or suggestion
- output of
pip list
from the virtual environment you are using - pytest and operating system versions
- minimal example if possible
pietrodantuono
Metadata
Metadata
Assignees
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanism