poetry new <project-name>poetry add <library>poetry remove <library>poetry update <library>poetry run which pythonpoetry run python app.pypoetry run python -m unittest discoverpoetry show1 - Edit pyproject.toml:
[tool.poetry.scripts]
test = 'scripts:test'2 - Create a scripts.py file on the root directory of your project:
import subprocess
def test():
"""
Run all unittests. Equivalent to:
`poetry run python -u -m unittest discover`
"""
subprocess.run(
['python', '-u', '-m', 'unittest', 'discover']
)3 - Run script:
poetry run testpoetry config virtualenvs.create falsepoetry config --list