matthewwithanm / django-imagekit

Automated image processing for Django. Currently v4.0
http://django-imagekit.rtfd.org/
BSD 3-Clause "New" or "Revised" License
2.27k stars 275 forks source link

Switch to pytest #537

Closed jaap3 closed 2 years ago

jaap3 commented 2 years ago

The current test suite uses django-nose. Nose has been unmaintained for a long time, and has stopped working in Python 3.10.

After some research it seems that switching to pytest is the best option. I have a branch where nose is replaced by pytest, you can see the results here: https://github.com/leukeleu/django-imagekit/pull/2

This is based on the GitHub actions branch (PR #536).

vstoykov commented 2 years ago

Perfect! This will be verry good contribution. I already merged #536. You can open another PR with the switch to pytest.

I just have few recommendations.

  1. In the places where you replaces @raises(...) with with pytest.raises(...) to put inside the with scope only the last line. This way we can benefit from pytest and improve the tests to be more accurate what exactly they test.
  2. To use something not in some_list instead of not something in some_list. This is more pythonic way of checking if something is inside collection. If the format that you used is explicitly needed by pytest (I'm no so familiar) then leave it like that.
  3. Can you also add pytest-cov? The old nose configuration has coverage enabled.

Thank you for your work on making django-imagekit better!

jaap3 commented 2 years ago

I've created PR #538 which includes your suggestions