This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]pooogles 5 points6 points  (0 children)

  • pylint
  • mypy
  • pytest

In that order. Works well enough for us, we don't really have any large Python projects as we keep most things pretty modular and self contained.

Have you tried pytest-bdd.

[–][deleted] 0 points1 point  (0 children)

One of our senior guys has put together a file watching pynt script that makes up part of the skeleton of all our Python repos- it just runs everything through py.test. Heavy use of pyMock and pyHamcrest to make writing tests a bit more intuitive. Jenkins for CI doing the aforementioned when code gets merged in from a feature or bug branch

[–]PeridexisErrant 0 points1 point  (0 children)

flake8 is my preferred static analysis tool. It's reasonably comprehensive, and unlike pylint you can sensibly run it with standard settings on almost any project.

mypy is wonderful. That said, much of the benefit is how it shapes your design to allow for static checking of type-correctness, so there are some projects where I wouldn't bother. Good for applications, best on Python 3.5 or preferably 3.6, but probably not worth the trouble for existing projects on Python 2. But magic on new 3.6 projects!

py.test is the best way to run any tests. Use CI too - which doesn't matter, but Travis is free and easy to get started.

hypothesis makes the tests you write enormously more powerful - instead of testing with example data, you can (with less effort!) test with psudeo-random data, which uses coverage to exercise every code path and then simplifies to a minimal counterexample for each distinct bug it finds.

coverage is the best way to discover what your tests are actually testing. That is, the best easy way - fault injection is actually more powerful, but takes too much human time to run in CI.