Pytest does not find my tests in Poetry project (VSCode finds)

I've just created my first Python package using Poetry using the usual poetry new mypackage command. My problem is that pytest does not execute any test when I run it. I'm developing using VSCode and the weird behavior is that VSCode successfully finds and executes my tests.

Poetry created a subdir called mypackage and another called tests. My test file is called tests/test_mypackage.py.

VSCode autodiscoverd the tests, and display them in the test tab. The .vscode/settings.json file has this configuration:

"python.testing.pytestArgs": [
        "tests"
    ],

I've tried the following commands to execute pytest:

  1. With my venv manually activated:
    1. pytest
    2. pytest tests
    3. pytest tests/test_mypackage.py
    4. cd tests;pytest test_mypackage.py
  2. without my venv activated:
    1. poetry run pytest
    2. poetry run pytest tests

The behavior is always the same: nothing happens, as if pytest couldn't detect anything to run.

I've been using VSCode to run the tests, but now I want to put the code under Continuous Integration. How do I run pytest to validate my package?

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum