jeudi 28 mai 2020

Best way to architect test development in Python so that tests can be run either with a mock or without a mock?

I'm starting a fresh python project and I want to write unit and integration tests with mocking and stubbing. However, I would like to run these tests during the build-pipeline against actual services by spawning these dependent services in a docker container. What is the best way to architect my project so that I can easily enable and disable mocking so that:

  • tests are run with mocks in local branches
  • tests are run with actual services (with mocks disabled) in CI build pipeline

I'm using python3 and pytest for my purposes.

Aucun commentaire:

Enregistrer un commentaire