Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError when run test #77

Open
rcy17 opened this issue Mar 3, 2020 · 1 comment
Open

ImportError when run test #77

rcy17 opened this issue Mar 3, 2020 · 1 comment

Comments

@rcy17
Copy link

rcy17 commented Mar 3, 2020

Environment

  • Python 3.7
  • Django 3.0.3
  • django-thumbnails 0.2.2

Problem

When I try to run test code:

`which django-admin.py` test thumbnails --settings=thumbnails.tests.settings --pythonpath=.

Exception is raised that ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding' (/home/holder/repo/dyf_api/venv/lib/python3.7/site-packages/django/utils/encoding.py), which, I believe, is caused by an old version of django.

Suggestion

After searching some information, I find some a similar issue in other packages about django, which says after a special version of django, method python_2_unicode_compatible is moved to six, so I think maybe you can update this path.

@rcy17
Copy link
Author

rcy17 commented Mar 3, 2020

After I fix that in my local package, I meet new problem:

Creating test database for alias 'default'...
System check identified no issues (0 silenced).
EEEEEEEEEEEE..........E.
======================================================================
ERROR: test_delete_thumbnails (thumbnails.tests.test_commands.CommandTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_commands.py", line 16, in test_delete_thumbnails
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_django_template (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_fallback_image (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_image_field (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_resize_source_to_none (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_thumbnail_field (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_thumbnails_cache (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_thumbnails_without_source (thumbnails.tests.test_fields.ImageFieldTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_fields.py", line 17, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_get_file_path (thumbnails.tests.test_files.FilesTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_files.py", line 19, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_create (thumbnails.tests.test_images.ImageTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_images.py", line 15, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_delete (thumbnails.tests.test_images.ImageTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_images.py", line 15, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_get (thumbnails.tests.test_images.ImageTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_images.py", line 15, in setUp
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

======================================================================
ERROR: test_optimize (thumbnails.tests.test_post_processors.PostProcessorsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./thumbnails/tests/test_post_processors.py", line 10, in test_optimize
    with open('thumbnails/tests/tests.png', 'rb') as image_file:
FileNotFoundError: [Errno 2] No such file or directory: 'thumbnails/tests/tests.png'

----------------------------------------------------------------------
Ran 24 tests in 0.054s

FAILED (errors=13)
Destroying test database for alias 'default'...

I have no idea why this error occurs. Can you give me some guidance please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant