I am writing a test case for a Django model with FileField. I would like to change the boot path so that the tests do not have side effects for the rest of the system.
I tried passing the called ones for upload_to and the fixes that are in the tests:
#models.py upload_path = lambda x, y: 'files' class Model(models.Model): file = models.FileField(upload_to=upload_path)
However, this does not work, and I believe the reason is that upload_path is dereferenced by FileField before any test code is run, so it's too late to fix things.
How can I change the test code, what is upload_to? Otherwise, how can the model check if this test is running?
source share