treebeardtech / nbmake

📝 Pytest plugin for testing notebooks
https://pypi.org/project/nbmake/
Apache License 2.0
184 stars 18 forks source link

Design Test Virtualisation #1

Closed alex-treebeard closed 3 years ago

alex-treebeard commented 3 years ago

Ensuring !pip install commands work without contaminating the test environment in the general case requires some thought -- requirements:

  1. When running against system packages e.g. in a github actions runner, you want the notebook's virtualenv to fall back to --system-site-packages
  2. When running locally in a venv, you may prefer to clone the virtualenv from which pytest is running.
  3. When running in a conda environment, you either want to clone the conda environment, or create a virtualenv that falls back to it.
  4. How do we test this behaviour? Some integration test running in a docker container?
alex-treebeard commented 3 years ago

Closing as this would be better solved with an autouse fixture

bkanuka commented 1 year ago

Hey - I'm interested in running each notebook in it's own "clean" virtual environment. What do you mean by solving this with an autouse fixture?

alex-treebeard commented 1 year ago

hi @bkanuka, there already exists a fixture for running a pytest test case in a venv (see this repo: https://github.com/man-group/pytest-plugins)

My assumption was you can find a solution where it is an autouse fixture such that adding venv as an nbmake feature is redundant.

If you find this isn't the case it would be helpful to understand where the gap is -- we could then reopen this.