PyCharm 2019.1+ and pytest
First, create a file named pytest.ini in order to set up custom configurations. For example, by default pytest
will consider any file matching with test_*.py
and *_test.py
globs as a test module, so I encourage to have this file in order to define your custom file name patterns.
pytest.ini
[pytest]
python_files = test_*.py tests.py *_test.py
Now, open up the Run/Configuration window:

Add a new configuration, select Python tests and pytest:

In the following window you choose a name for your configuration, and you can also choose the target, but if you want pytest to use the pytest.ini
file do not select Script path, APPLY, and OK.

Finally, run the test by clicking on the Play button.
