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

unit tests failing in newer python versions (3.8) because self.thumbnails cannot be appended to #133

Open
MoralCode opened this issue Dec 10, 2022 · 1 comment · May be fixed by #134
Open

Comments

@MoralCode
Copy link

MoralCode commented Dec 10, 2022

python version 3.8.6 (using pyenv, although it may inadvertently have been using 3.10)
dependencies installed: the ones in requirements-dev.txt in addition to sqlalchemy python-magic pillow flask_cors via pipenv

Procedure: use command python -m pipenv run python3 -m unittest or similar to run the unit tests while in the sqlalchemy-media directory.

Expected: tests pass

Actual: tests are failing

Output (the last part of it at least):

======================================================================
ERROR: sqlalchemy_media.tests.test_google_cloud_storge (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: sqlalchemy_media.tests.test_google_cloud_storge
Traceback (most recent call last):
  File "/usr/lib/python3.10/unittest/loader.py", line 436, in _find_test_path
    module = self._get_module_from_name(name)
  File "/usr/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/tests/test_google_cloud_storge.py", line 7, in <module>
    from sqlalchemy_media.stores.GoogleCloudStorage import GoogleCloudStorge
ImportError: cannot import name 'GoogleCloudStorge' from 'sqlalchemy_media.stores.GoogleCloudStorage' (/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/stores/GoogleCloudStorage.py)


======================================================================
ERROR: test_image_list (sqlalchemy_media.tests.test_image.ImageTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/tests/test_image.py", line 291, in test_image_list
    thumbnail = person1.images[0].get_thumbnail(
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 862, in get_thumbnail
    return self.generate_thumbnail(width, height, ratio)
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 816, in generate_thumbnail
    self.thumbnails.append((width, height, ratio, thumbnail))
AttributeError: 'NoneType' object has no attribute 'append'

======================================================================
ERROR: test_image_thumbnail_pre_generate (sqlalchemy_media.tests.test_image.ImageTestCase)
Issue #72
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/tests/test_image.py", line 237, in test_image_thumbnail_pre_generate
    person1.image.generate_thumbnail(width=100)
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 816, in generate_thumbnail
    self.thumbnails.append((width, height, ratio, thumbnail))
AttributeError: 'NoneType' object has no attribute 'append'

======================================================================
ERROR: test_thumbnail (sqlalchemy_media.tests.test_image.ImageTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/tests/test_image.py", line 64, in test_thumbnail
    thumbnail = person1.image.get_thumbnail(
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 862, in get_thumbnail
    return self.generate_thumbnail(width, height, ratio)
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 816, in generate_thumbnail
    self.thumbnails.append((width, height, ratio, thumbnail))
AttributeError: 'NoneType' object has no attribute 'append'

======================================================================
ERROR: test_thumbnail_delete (sqlalchemy_media.tests.test_image.ImageTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/tests/test_image.py", line 182, in test_thumbnail_delete
    thumbnail = person1.image.get_thumbnail(
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 862, in get_thumbnail
    return self.generate_thumbnail(width, height, ratio)
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 816, in generate_thumbnail
    self.thumbnails.append((width, height, ratio, thumbnail))
AttributeError: 'NoneType' object has no attribute 'append'

======================================================================
ERROR: test_rrs_put (sqlalchemy_media.tests.test_s3_store.S3StoreTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/tests/test_s3_store.py", line 93, in test_rrs_put
    thumbnail = person1.image.get_thumbnail(
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 862, in get_thumbnail
    return self.generate_thumbnail(width, height, ratio)
  File "/home/ace/Projects/Current/GenericInventory/sqlalchemy-media/contrib/sqlalchemy-media/sqlalchemy_media/attachments.py", line 816, in generate_thumbnail
    self.thumbnails.append((width, height, ratio, thumbnail))
AttributeError: 'NoneType' object has no attribute 'append'

----------------------------------------------------------------------
Ran 83 tests in 10.306s

FAILED (errors=6)

the error seems to be due to a lack of ability to set self.thumbnails in attachments.py line 815. it seems like this might be due to changes made to python in newer versions (and thus related somewhat to #131)

@MoralCode MoralCode changed the title unit tests failing because self.thumbnails cannot be appended to unit tests failing in newer python versions (3.8) because self.thumbnails cannot be appended to Dec 10, 2022
@MoralCode
Copy link
Author

I believe I have solved the problem on my fork of this repo

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