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

Minor testing cleanups #1782

Merged
merged 3 commits into from May 23, 2023
Merged

Minor testing cleanups #1782

merged 3 commits into from May 23, 2023

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.

* 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
Contributor

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
Copy link
Contributor

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()]))
Copy link
Contributor

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 jazzband:main May 23, 2023
21 checks passed
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants