top | item 21904452

(no title)

maksimum | 6 years ago

> The condition is, though, that I need to be able to quickly run the program to validate just all of it to work.

That's a condition for all TDD.

> I know there's testing frameworks, although it seems more of an eclectic mess than Java

If you look at the test suites for popular libraries like numpy, django, airflow it's mostly `pytest`, `unittest` (part of the standard library), and `nose`.

> where testing and mocking is just a little harder to do...

Mocking is actually pretty easy to do in python using pytest.monkeypatch or unittest.mock. Compared to mocking in a strongly typed language like C++ (and I assume Java) if an object you're mocking implements a particular interface, you would only have to mock out the parts that get exercied by the codepath in the tests you care about.

discuss

order

sverhagen|6 years ago

> That's a condition for all TDD.

I was saying, run the program, not run a test in a larger suite.

> > where testing and mocking is just a little harder to do...

You were quoting me trying to say that mocking out system interactions, such as I /O, things with external side-effects, tends to be harder, regardless of Python versus Java.

> Mocking is actually pretty easy to do in python

Let's disagree. As a Java developer, doing some Python takes me a moderate amount of online searching, unless I'm writing the test code, during which the online searching and associated trial and error skyrockets.

Just my modest experience.