-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Minor testing cleanups #1782
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
Minor testing cleanups #1782
Conversation
* 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.
There was a problem hiding this 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} |
There was a problem hiding this comment.
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
@@ -40,7 +39,7 @@ setenv = | |||
PYTHONPATH = {toxinidir} | |||
PYTHONWARNINGS = d | |||
py39-dj32-postgresql: DJANGO_SELENIUM_TESTS = true | |||
py310-dj41-postgresql: DJANGO_SELENIUM_TESTS = true | |||
py311-dj42-postgresql: DJANGO_SELENIUM_TESTS = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
@@ -149,7 +149,7 @@ def test_non_ascii_query(self): | |||
self.assertEqual(len(self.panel._queries), 2) | |||
|
|||
# non-ASCII bytes parameters | |||
list(User.objects.filter(username="café".encode())) | |||
list(Binary.objects.filter(field__in=["café".encode()])) |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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
.
Thanks! |
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.