Test package installation in temporary virtual environment#519
Test package installation in temporary virtual environment#519matt-graham merged 6 commits intomainfrom
Conversation
|
I don't think the link checker check fail is anything to do with changes in this PR as it doesn't change or add any URLs. It looks like it might be due to flagging |
samcunliffe
left a comment
There was a problem hiding this comment.
Looks great!
2 ± 1 things come to mind:
- Did you look at
pytest-venv? It's unfortunately not receiving so much dev (last commit ~2 years ago). But it (or something similar) might cut down on some of the boilerplate? - Alternatively we could plop all of this into a fixture (i.e. do as they do in the
pytest-venvplugin but with our own code. - The whole package generation test... um is there a smarter way to do it (I appreciate that is less of a comment for this bugfix and more of a general unhelpful musing).
I hadn't come across |
There must be. I do think it's currently causing more problems than it has solved. |
|
There is https://github.com/hackebrot/pytest-cookies, but it is unmaintained as well (tho used for testing in https://github.com/osl-incubator/scicookie). If we end up migrating to copier, we can use https://github.com/12rambau/pytest-copie. |
|
Updated to use so I added a manual override to ignore import. Alternative would be not to add a type annotation for |
|
Link checker flaking again (tried one re-run) this time due to |
Coveralls is currently down |
samcunliffe
left a comment
There was a problem hiding this comment.
Nice!
I'd say the new dependency is worth it for the one-liner environmentisation of our messy tests. (I think I've invented "environmentisation".)
paddyroddy
left a comment
There was a problem hiding this comment.
Nice, pytest_venv looks much neater than previous iteration
Co-authored-by: Patrick J. Roddy <patrickjamesroddy@gmail.com>
Resolves #516
Creates a virtual environment in temporary package directory and tests package installation in there rather than installing in parent environment tests are run from.
Calling
pip installcommand by directly referencing Python executable in created virtual environment seems to work in terms of ensuring package is installed insite-packagesof temporary virtual environment rather than parent environment (at least I no longer see acookiecutter-testentry when runningpip listafter running tests) and it seemed non trivial tosourcethe virtual environment script withsubprocess.run.