Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run tests before the commit in Pycharm/Intellij Idea

Is it possible to run a specified script before any commit in Pycharm/Intellij Idea? I want to make sure that tests are not broken. Thanks.

like image 947
dbf Avatar asked Dec 23 '12 20:12

dbf


People also ask

How do I run a python test in IntelliJ?

Run all Python tests in a directoryIn the Project tool window, select the directory that contains tests to be executed. From the context menu, select the corresponding run command. If the directory contains tests that belong to the different testing frameworks, select the configuration to be used.

How do I set the default test runner in PyCharm?

To set a test runner, press Ctrl+Alt+S to open the IDE settings and select Tools | Python Integrated Tools, and then select the target test runner from the Default test runner list.


1 Answers

If you don't want to buy a TeamCity licence, you can also use the "toggle auto-test" feature that re-runs your tests whenever you change them.

It does not block your commits but warns you when you have a failed test.

like image 119
Vincent J Avatar answered Oct 21 '22 05:10

Vincent J