How can I test binary file uploading with django-rest-framework’s test client?

When testing file uploads, you should pass the stream object into the request, not the data. This was pointed out in the comments by @arocks Pass { ‘image’: file} instead But that didn’t full explain why it was needed (and also didn’t match the question). For this specific question, you should be doing from PIL … Read more

Running django tutorial tests fail – No module named polls.tests

I had exactly the same issue with my Django project: $ python manage test polls.tests worked fine whereas the following failed with an import error: $ python manage test polls $ python manage test (…) ImportError: Failed to import test module: mydjango.polls.tests Traceback (most recent call last): (…) ImportError: No module named polls.tests Check carefully … Read more