Friday, 26 October 2018

Conditions based on Stage (dev, qual, prod)

In my context the systems have a stage. A system can be a production system, a system for quality assurance or a development system.

I know that conditions based on the stage should be avoided and in tests mocking should be used to change things. For example third party systems are not available during unittesting and mocking should be used to fake the existence of third party systems.

But sometimes I have conditions like this:

if settings.STAGE == constants.STAGE_DEV:
    ....

Up to now constants is from our legacy library.

I would like to use as much open source solutions as possible and avoid coding fundamental things ourselves.

Is there a better way than using above homegrown solution?



from Conditions based on Stage (dev, qual, prod)

No comments:

Post a Comment