Providing a way to specify how to run tests (and docs?)

It’s already the case with package build backend and frontends, so if anything we would just remain consistent and not deviate.

task runners can/should provide a mode to run in host mode, e.g. for tox see GitHub - fedora-python/tox-current-env: tox plugin to run tests in current Python environment that makes this a non-problem.

Would be fairly trivial to standardize those via defining your test and docs targets for the task runner:

[project.tasks]
requires = ["tox>=4"]
targets.test = ["py-unit", "py-integration"]
targets.docs = ["docs"]

This would be fairly simple tough on both ends. For task runners we only really need tox, nox and pyinvoke. There’s precedence here, adopting PEP-517 was fairly easy for flit/setuptools. They just had to expose what they already did under a new common API.

Hence why I don’t like it that much. If the user sets up a testing (or documentation) tool here it easily can fail downstream or on another machine because you never addressed all the other factors at play here:

I think it’s similarly important that whatever we come up can live together with task runners and not cannibalize it. It would be a bad place where some of your test setup/teardown logic is in the tasks section and the rest in nox/tox configuration files (ini, toml or python file).

1 Like