[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1053413: RFP: tox-current-env -- tox plugin to run tests in current Python environment



Control: retitle -1 ITP: tox-current-env -- tox plugin to run tests in
current Python environment
Control: owner -1 Bo YU <tsu.yubo@gmail.com>

On Wed, Oct 4, 2023 at 12:15 AM Antoine Beaupre <anarcat@debian.org> wrote:
>
> Package: wnpp
> Severity: wishlist
> X-Debbugs-Cc: debian-python@lists.debian.org
>
> * Package name    : tox-current-env
>   Version         : 0.0.11
>   Upstream Contact: Miro Hrončok <miro@hroncok.cz>
> * URL             : https://github.com/fedora-python/tox-current-env
> * License         : MIT
>   Programming Lang: Python
>   Description     : tox plugin to run tests in current Python environment
>
> The tox-current-env plugin adds these options:
>
> tox --current-env
>     Runs the tox testenv's commands in the current Python environment
>     (that is, the environment where tox is invoked from and installed
>     in). Unlike regular tox invocation, this installs no dependencies
>     declared in deps. An attempt to run this with a Python version
>     that doesn't match will fail (if tox is invoked from an Python 3.7
>     environment, any non 3.7 testenv will fail).
>
> tox --print-deps-to=FILE
>     Instead of running any commands, simply prints the declared
>     dependencies in deps to the specified FILE. This is useful for
>     preparing the current environment for tox --current-env. Use - for
>     FILE to print to standard output.
>
> tox --print-extras-to=FILE
>     Instead of running any commands, simply prints the names of the
>     declared extras in extras to the specified FILE. This is useful
>     for preparing the current environment for tox --current-env. Use -
>     for FILE to print to standard output.
>
> It is possible to use the two printing options together, as long as
> the FILE is different.
>
> Invoking tox without any of the above options should behave as regular
> tox invocation without this plugin. Any deviation from this behavior
> is considered a bug.
>
> The plugin disables tox's way of providing a testing environment, but
> assumes that you supply one in some other way. Always run tox with
> this plugin in a fresh isolated environment, such as Python
> virtualenv, Linux container or chroot. See other caveats below.
>
> Obviously, tox was created to run tests in isolated Python virtual
> environments. The --current-env flag totally defeats the purpose of
> tox. Why would anybody do that, you might ask?
>
> Well, it turns out that tox became too popular and gained another purpose.
>
> The Python ecosystem now has formal specifications for many pieces of
> package metadata like versions or dependencies. However, there is no
> standardization yet for declaring test dependencies or running
> tests. The most popular de-facto standard for that today is tox, and
> we expect a future standard to evolve from tox.ini. This plugin lets
> us use tox's dependency lists and testing commands for environments
> other than Python venvs.
>
> We hope this plugin will enable community best practices around tox
> configuration to grow to better accomodate non-virtualenv environments
> in general – for example, Linux distros, Conda, or containers.
>
> Specifically, this plugin was created for Fedora's needs. When we
> package Python software as RPM packages, we try to run the project's
> test suite during package build. However, we need to test if the
> software works integrated into Fedora, not with packages downloaded
> from PyPI into a fresh environment. By running the tests in current
> environment, we can achieve that.
>
> ----
>
> In my case, I want to avoid constantly downloading unverified code
> from the internet, or, even worse, *compile* code (e.g. for
> python3-ldap, in my case) which involves a whole other pile of stuff
> to install.
>
> Other Tox plugins are currently maintained by the Python team (and
> Peter Pentchev), so it would probably be the same for this one.

OK, I will package it and maintain under DPT, thanks.

BR,
Bo


Reply to: