sqlalchemy-media icon indicating copy to clipboard operation
sqlalchemy-media copied to clipboard

Update code to ensure tests pass correctly in more modern verisons of python

Open MoralCode opened this issue 3 years ago • 0 comments

This PR attempts to fix the unit tests in the cleanest way possible with minimal changes to existing functionality.

Changes include:

  • sqlite databases used for tests are now saved to the output directory with the generated images (instead of in-memory) to allow failed tests to be more easily debugged
  • some fixes were made to attachments.py to correct an issue where thumbnails were not being correctly saved to an Image object, causing test failures (fixes #133)
  • more assertions were added to better detect the previous issue
  • some tweaks were mane to the Image unit tests to ensure that objects from the previous session weren't being reused in a new session (seemingly intended to simulate retrieval from the DB at a later time) and causing sqlalchemy to crash
  • small tweaks to variable names in image tests to make the intention clearer and prevent potential issues with variable shadowing
  • corrected typos in file and class naming for the GoogleCloudStorage class to allow the test to properly load
  • updated mocks and the file paths to the stuff/cat.jpg image in GoogleCloudStorage tests so the tests actually run

MoralCode avatar Dec 11 '22 15:12 MoralCode