Skip to content

Conversation

living180
Copy link
Contributor

Make some minor tweaks to the tox.ini file (the only functional change is enabling selenium tests for Python 3.11/Django 4.2 instead of for Python 3.10/Django 4.1), and fix a few warnings generated by the tests.

living180 added 3 commits May 16, 2023 15:00
* Simplify envlist specification (no functional changes) * Tweak dj42 django dependency specification * Enable selenium tests for Python 3.11/Django 4.2 instead of for Python 3.10/Django 4.1. * Minor file formatting tweaks.
Switch from setting the options.headless attribute to calling options.add_argument("-headless"). See [1] for more info. [1] https://www.selenium.dev/blog/2023/headless-is-going-away/
Don't pass bytes objects as filter arguments for CharField fields. They get passed to str() internally within Django which results in a BytesWaring.
Copy link
Member

@matthiask matthiask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apt-get doesn't like us today it seems.

py{38,39,310}-dj32-{sqlite,postgresql,postgis,mysql}
py310-dj40-sqlite
py{310,311}-dj41-{sqlite,postgresql,postgis,mysql}
py{310,311}-dj{42,main}-{sqlite,postgresql,psycopg3,postgis,mysql}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for cleaning this up

PYTHONWARNINGS = d
py39-dj32-postgresql: DJANGO_SELENIUM_TESTS = true
py310-dj41-postgresql: DJANGO_SELENIUM_TESTS = true
py311-dj42-postgresql: DJANGO_SELENIUM_TESTS = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch


# non-ASCII bytes parameters
list(User.objects.filter(username="café".encode()))
list(Binary.objects.filter(field__in=["café".encode()]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose behind changing this from a bytes to a list of bytes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that even with BinaryField, using .filter(field="café") would generate a BytesWarning internally within Django. Not wanting to shave that particular yak, I found that switching to the form above allowed the test to proceed without any BytesWarning.

@matthiask matthiask merged commit 476b5ce into django-commons:main May 23, 2023
@matthiask
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants