Closed camilonova closed 11 years ago
This is a very good suggestion. Do you have anything in mind to implement this? Maybe using a unique directory for all DDF files..
Could you try the FileSystemDjangoTestCase? https://github.com/paulocheque/django-dynamic-fixture/wiki/Documentation#wiki-filesystem
There is a known issue in FileSystemDjangoTestCase on Windows. It may be related with the Windows Registry according to https://github.com/valdergallo.
remove_temp_file os.remove(filepath) WindowsError: [Error 32] The process cannot access the file because it is being used by another process:
We have 2 options to implement this: 1 - Change all create files to StringIO 2 - Change by default on ddf to use settings.DEFAULT_FILE_STORAGE=FileSystemStorage(location=TEMP_PATH)
Because Django use by default FileSystemStorage location on MEDIA_ROOT, all tests files will be created on STATIC directory. But DDF just try delete files in TEMP_PATH.
def fdf_teardown(self):
if self.TEAR_DOWN_ENABLED:
while self.files:
self.remove_temp_file(self.files.keys()[0])
while self.directories:
self.remove_temp_directory(self.directories[0])
Thanks for reporting. Thanks for the pull request!
If i create a test, and use the dynamic fixture on a model that contains a FileField, it creates a file, and after the test ends the created file is not removed from the file system.
Could you add some way to remove those images?