0

I have a file config.py and there is a variable in it balance_check which is true by default. I have one more alltests.py which takes certain parameters and executes other files. I want to set the value of balance_check variable to false when i am passing some particular parameter to alltests file but some how the variable does not changes for sub sequent files called from alltests.py file

1 Answer 1

2
from ... import config

config.balance_check = False

This is called monkey patch

Sign up to request clarification or add additional context in comments.

2 Comments

I tried this but when alltests.py is calling other python file it seems that the scope of balance_check var ends and the value is picked from config.py file directly which is True.
you execute alltests file, it sets balance_check variable to False in config file, then call another file and in that file you use balance_check variable from config file but it is still True, am i right?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.