Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing only affected code in Python

Tags:

python

testing

I've been working on a fairly large Python project with a number of tests.

Some specific parts of the application require some CPU-intensive testing, and our approach of testing everything before commit stopped making sense.

We've adopted a tag-based selective testing approach since. The problem is that, as the codebase grows, maintaining said tagging scheme becomes somewhat cumbersome, and I'd like to start studying whether we could build something smarter.

In a previous job the test system was such that it only tested code that was affected by the changes in the commit.

It seems like Mighty Moose employs a similar approach for CLR languages. Using these as inspiration, my question is, what alternatives are there (if any) for smart selective testing in Python projects?

In case there aren't any, what would be good initial approaches for building something like that?

like image 322
Cesar Kawakami Avatar asked Nov 19 '12 04:11

Cesar Kawakami


1 Answers

I guess you are looking for a continuous testing tool?

I created a tool that sits in the background and runs only impacted tests: (You will need PyCharm plugin and pycrunch-engine from pip)

https://github.com/gleb-sevruk/pycrunch-engine

This will be particularly useful if you are using PyCharm.

More details are in this answer: https://stackoverflow.com/a/58136374/2377370

like image 149
Gleb Sevruk Avatar answered Nov 15 '22 16:11

Gleb Sevruk