Is TDD broken in Python?

Posted by Konstantin on Stack Overflow See other posts from Stack Overflow or by Konstantin
Published on 2010-04-30T00:21:03Z Indexed on 2010/04/30 0:27 UTC
Read the original article Hit count: 651

Filed under:
|
|
|
|

Hi!

Assume we have a class UserService with attribute current_user. Suppose it is used in AppService class.

We have AppService covered with tests. In test setup we stub out current_user with some mock value:

UserService.current_user = 'TestUser'

Assume we decide to rename current_user to active_user. We rename it in UserService but forget to make change to its usage in AppService.

We run tests and they pass! Test setup adds attribute current_user which is still (wrongly but successfully) used in AppService.

Now our tests are useless. They pass but application will fail in production.

We can't rely on our test suite ==> TDD is not possible.

Is TDD broken in Python?

© Stack Overflow or respective owner

Related posts about TDD

Related posts about python