0

Let's suppose I do some change to a function in the tests.py file, like monkey patching the clean method of some form...

When all the tests are finished, will that method still have associated the function I assigned?

A concrete example (to avoid captcha validation when testing):

from myapp.fields import ReCaptchaField
ReCaptchaField.clean = lambda x, y: y[0]

The same applies to adding/changing some field in the settings.py file...

Oscar Mederos
  • 26,873
  • 20
  • 76
  • 120

1 Answers1

0

Yes, it will remain associated. That's the benefit/side-effect/danger of monkey-patching, change the default behavior during the process lifetime.

Armando Pérez Marqués
  • 5,101
  • 3
  • 28
  • 43