test_pip_installable
test make persistent changes to environment test is run in
#516
Labels
bug
Something isn't working
Describe the Bug
The test in
tests/test_package_generation.py::test_pip_installable
python-tooling/tests/test_package_generation.py
Lines 95 to 123 in a3003e2
installs an instance of the template with the package name
cookiecutter-test
in the Python environment the test is run in, and this installation is not removed after test completion (successful or not).While the actual generated package directory is created in a temporary directory that is cleared, the references to this package in the environment
site-packages
directory are not cleaned up.I think we probably should create a virtual environment in a temporary directory and tests the package installation there. While we could just remove the package after checking installation, this has the downside that if we in future add any default dependencies to the package template then we would need to remember to also remove these.
To Reproduce
Create a clean virtual environment, install
pytest
. Runpip list
to see initial installed packageRun
from root of repository.
Run
pip list
again and compare to previous output.Expected Behaviour
No persistent changes to environment are made by tests, in particular no hanging package installation references are left - specifically
pip list
output is same before and after running tests.Actual Behaviour
pip list
output changed after running tests - there will be an additionalcookiecutter-test
package listed pointing to a now non-existent temporary directory.Version In Use
v1.0.0-31-ga3003e2
Additional Context
The text was updated successfully, but these errors were encountered: