Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
149 views
in Technique[技术] by (71.8m points)

python - How to disable a decorator on a method, if that method is called in django tests?

I have a function that is like:

@dec_func
def a():
    do_something;

In my django tests this function is ran in execution. Now i want that whenever the tests run my function a should not get decorated dec_func but if the function runs in development or production environment, method should be decorated. How to do so.

question from:https://stackoverflow.com/questions/65883722/how-to-disable-a-decorator-on-a-method-if-that-method-is-called-in-django-tests

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...