If I only use a library during test suite runs, should it be in normal or dev packages in my Pipfile?

295 Views Asked by At
  • We use built-in unittest (or Django's wrappers) for testing a Python project.
  • In some of those tests, we use libs like freezegun or mock, 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.

Is it common to leave those in the dev-packages section of the Pipfile, or should test-related packages also reside in packages?

1

There are 1 best solutions below

0
On

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)