PyCharm: Run All Unit Tests in a Folder/Package

My unit tests can be started individually from the context menu. I can also run all of them using something like

nosetests ./*tests.py

from within that specific folder containing the tests.

I played around a while with PyCharm to find a run configuration that actually allows me to runn all tests from all files within a folder at mouseclick.

Create a run configuration using Edit Configurations from the menu, add one with the ‚+‘ sign and choose any python unittest that suits your needs from the list of options:

PyCharm Testrunner configuration
PyCharm Testrunner configuration

The tricky bit is the pattern. My test unit files all end in *tests.py – I played aroung ab bit, until the regex really worked:

^.*tests.py$
.*tests.py$
.*tests.py

I settled for the middle option, but all 3 work.

Print Friendly, PDF & Email

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.