jazzband / django-queued-storage

Provides a proxy for Django storage backends that allows you to upload files locally and eventually serve them remotely
http://django-queued-storage.rtfd.org/
BSD 3-Clause "New" or "Revised" License
318 stars 62 forks source link

Change install_requires in setup.py? #33

Open msaizar opened 6 years ago

msaizar commented 6 years ago

django-celery is not compatible with the latest Celery version, which already comes with Django integration. Is it possible to remove this requirement, or make a conditional requirement such as django-celery>=3.1 or celery>=4.0?

jezdez commented 6 years ago

Yeah, not a bad idea. Mind sending a PR?

msaizar commented 6 years ago

One test seems to be failing for me, whether I remove the requirement or not.

    def test_transfer_retried(self):
        """
            Make sure the transfer task is retried correctly.
            """
        storage = QueuedStorage(
            local='django.core.files.storage.FileSystemStorage',
            remote='django.core.files.storage.FileSystemStorage',
            local_options=dict(location=self.local_dir),
            remote_options=dict(location=self.remote_dir),
            task='tests.tasks.RetryingTask')
        field = models.TestModel._meta.get_field('testfile')
        field.storage = storage

        self.assertFalse(models.TestModel.retried)

        obj = models.TestModel()
        obj.testfile.save(self.test_file_name, File(self.test_file))
        obj.save()
>       self.assertFalse(obj.testfile.storage.result.get())
        self.assertTrue(models.TestModel.retried)

E RuntimeError: Never call result.get() within a task! E See http://docs.celeryq.org/en/latest/userguide/tasks.html#task-synchronous-subtasks

I am unable to fix that test, but removing that assert is a workaround. This test seems to work with Celery <4, it starts failling on Celery <=4.