- We use built-in unittest (or Django's wrappers) for testing a Python project.
- In some of those tests, we use libs like
freezegun
ormock
, which aren't used anywhere in the production codebase. - Our CI that runs tests installs all deps before a test run, so usually we'd put those in dev-deps.
Asked
Active
Viewed 248 times
1
Is it common to leave those in the

anonymous coward
- 12,594
- 13
- 55
- 97
-
I have never even *thought* about this. I also think it will be hard for any one person to speak for how common this practice is. I haven't seen a colleague do this, nor have I done it myself. But that's just a personal anecdote. I've always just used requirements.txt or anaconda out-of-the-box, so everything is just mashed together in the same site-packages. Haven't really had any problems with that strategy yet *knock on wood*. Do you have a good reason to worry about it (like hundreds of test-only dependencies)? – Matt Messersmith Aug 10 '18 at 17:40
-
For the record, I already have some opinions about this, but thought it might make a useful public question, having not seen it yet. – anonymous coward Aug 10 '18 at 18:04
-
To be clear, I think test-related deps would go into `dev-packages`, at least as much as I've run into it and as far as my work has taken me (strong opinions held loosely and all). And clearly this only applies to use of Pipenv where there's a distinction. Obviously I'm interested in feedback from others on how they've approached the same. – anonymous coward Aug 10 '18 at 18:06
1 Answers
2
a small note about mock
since Python v3.3 it's part of the unittest
module.
Said that, in theory would be better to keep those kind of packages in the dev-dependencies. In practice you could ignore the problem unless you
- you have tons of dependencies
- some dependency is hard to install (maybe it requires a C compiler installed or something similar)

Massimo Costa
- 1,864
- 15
- 23