Poetry: A new command: poetry test

Created on 19 Nov 2020  路  7Comments  路  Source: python-poetry/poetry

  • [X] I have searched the issues of this repo and believe that this is not a duplicate.
  • [X] I have searched the documentation and believe that my question is not covered.

Feature Request


Implement a poetry test command.

Background

I've been using Makefiles (and sometimes just snippets of code) to manage testing over CIs and I'd like a poetry test command to manage centralize this (for some systems don't have GNU Make).

Demonstration

To configure it, there should be a new section in thepyproject.toml stating what poetry test does, like this:

[tool.poetry.test]
command = "pytest -vvv --cov=package_name"
after_success = 'echo "Yay! All tests have passed!" '

Implementation

Basically, poetry will run that command in a virtual environment (which does not include the package itself) that has installed all the dependancies.

Feature Triage

All 7 comments

While there is tox, poetry test would be a shorthand for poetry install && poetry run <test command>

If anything like that, then I'd rather see a general purpose shortcut for commands such as:

I might make a new issue proposing that instead. That's actually what I want: a centralized command shortcut (basically Makefiles except Makefiles are annoying)

There is always _pyinvoke_

I believe something like that could work (untested, pseudo code):

[tool.poetry.dev-dependencies]
invoke = '*'
import invoke

@invoke.task
def test(c):
    c.run('python -m pytest')
poetry run invoke test

Also maybe there are already tickets for a similar feature, I have not searched yet.

Related: https://github.com/python-poetry/poetry/pull/591#issuecomment-504762152

Poetry is a package and dependency manager, not a task manager. This feature is beyond the scope and the original purpose of Poetry and will likely never be integrated into it.

I'd say (as I commented on many other feature requests), wait until _poetry_ gets its plugin system (scheduled for _v1.2_), and this feature could hopefully be made into a poetry plugin.

Got it, I'll use pyinvoke for now

Suggestion: _poethepoet_ (see also this comment).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhrmnn picture jhrmnn  路  3Comments

mozartilize picture mozartilize  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments

probablykasper picture probablykasper  路  3Comments

tonysyu picture tonysyu  路  3Comments