akaihola / ipython_pytest

Pytest magic for IPython notebooks
Other
37 stars 8 forks source link

Setting/Emulating nested conftest.py folder structure? #2

Open patrickkidd opened 2 years ago

patrickkidd commented 2 years ago

Gret project. I am trying to prototype individual tests without waiting the 15s to spin up our entire app with necessary db connections etc - ours is a large project. It looks like a notebook would be great for this.

How can I get my notebook to behave as if it is in a certain subfolder in our test suite? I need to gain access to all the fixtures in the current folder and all folders above, as pytest normally does. Example:

project_root/tests/conftest.py project_root/tests/module_a/conftest.py project_root/tests/module_a/component_1/conftest.py project_root/tests/module_a/component_1/test_mymethod.py <-- I want my notebook to run as if it's in this folder, inheriting fixtures from all three conftest.py.

How to do that?

akaihola commented 2 years ago

Thanks for the idea @patrickkidd! Could you check whether #3 works for you?