3 ms·
Not necessarily. This is exactly the kind of thing I mean, in fact. I once had a bug scenario I wanted to reproduce with a test where the time was grabbed from
by MoreQARespect 3y ago
Not necessarily. This is exactly the kind of thing I mean, in fact.
I once had a bug scenario I wanted to reproduce with a test where the time was grabbed from datetime.now() in the first half of the scenario and indirectly via a postgres query in the second half (with a time delimited query).
With libfaketime I injected a new running service time and postgres service via the test runner. It let me do TDD to create a reproducible test - what you thought was impossible.
I could have jumped straight to dependency injection on that mess of a code base but that would have meant a risky architectural change that I would have to have done without tests. That is bad practice.
This sort of thing was not really possible in 2001 but it's possible now.