Hello, everyone!

Some time ago I wrote a pytest plugin [1] that helps with testing of
scripts declared by 'console_scripts' entry point in setup.py. The tests of
this plugin install a test package (let's call it TP) and then run TP's
tests that are verifying that the scripts declared by TP's setup.py work as
expected. TP is installed into the same python environment that runs the
outer tests (uninstalled at fixture cleanup) and then the inner tests are
run with the same pytest instance that runs the outer tests. This approach
is somewhat dirty, but it works fine with disposable virtualenvs that we
get from Tox.

In the process of trying to package this plugin for Fedora it turned out
that my test approach doesn't work with the way they run tests. They use
system python so my tests try to install things into system python, don't
have permissions and fail (see [2]).

I think this could be fixed by creating a virtualenv in tmpdir and using
that to install TP and run its tests. However, this new virtualenv would
need to have pytest and pytest-console-scripts installed in it in order to
run the inner tests. I'm planning to look into the ways to make a
virtualenv inherit packages from another virtualenv (or from system python,
as would be the case with Fedora package testing) but before I go into all
this, I thought I would ask around if maybe there's a better way.

Have any of you had situations where your tests needed to install packages
and run their tests and how did you go about this?

Thanks,
Vasily

[1]: https://pypi.org/project/pytest-console-scripts/
[2]: https://github.com/kvas-it/pytest-console-scripts/issues/11
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to