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

Rename SQLPanel context var to control SQL access. #1615

Merged
merged 1 commit into from May 3, 2022

Conversation

tim-schilling
Copy link
Contributor

The current build started failing for py3.8+ because the inner
exception SQLQueryTriggered was raised in the test
test_cursor_wrapper_asyncio_ctx.

This was identified as being caused by sql.tracking.recording
being set to false. The name recording made it seem as if
this context var was controlling whether recording was occurring
or not. However, it's true functionality was preventing SQL
queries from being sent during the template panel's processing.

Renaming that context var to allow_sql is more indicative of
its purpose and makes the fixed test change clearer.

The current build started failing for py3.8+ because the inner
exception SQLQueryTriggered was raised in the test
test_cursor_wrapper_asyncio_ctx.

This was identified as being caused by sql.tracking.recording
being set to false. The name recording made it seem as if
this context var was controlling whether recording was occurring
or not. However, it's true functionality was preventing SQL
queries from being sent during the template panel's processing.

Renaming that context var to allow_sql is more indicative of
its purpose and makes the fixed test change clearer.
@tim-schilling
Copy link
Contributor Author

@matthiask if you're good with this name change, I'll merge this and #1614 and release a new version today.

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.

Good find! Yes, please create a release if you find the time to do so.

@tim-schilling tim-schilling merged commit a0080f3 into jazzband:main May 3, 2022
@tim-schilling tim-schilling deleted the sql-panel-context-var branch May 3, 2022 12:40
@yuuyins
Copy link

yuuyins commented May 6, 2022

if you are kind enough to look and shred some light into this probably unsupported issue... I'm trying to update it NixOS/nixpkgs#171764 from 3.2.4 to 3.4

python3.9-django-debug-toolbar> shrinking RPATHs of ELF executables and libraries in /nix/store/s3j82nksp55mlwpixriscybsvfz99ws2-python3.9-django-debug-toolbar-3.4
python3.9-django-debug-toolbar> strip is /nix/store/k0np19xv7wjc1grhrb2y6r85qiv1cikd-gcc-wrapper-11.2.0/bin/strip
python3.9-django-debug-toolbar> stripping (with command strip and flags -S) in /nix/store/s3j82nksp55mlwpixriscybsvfz99ws2-python3.9-django-debug-toolbar-3.4/lib
python3.9-django-debug-toolbar> patching script interpreter paths in /nix/store/s3j82nksp55mlwpixriscybsvfz99ws2-python3.9-django-debug-toolbar-3.4
python3.9-django-debug-toolbar> checking for references to /build/ in /nix/store/s3j82nksp55mlwpixriscybsvfz99ws2-python3.9-django-debug-toolbar-3.4...
python3.9-django-debug-toolbar> Executing pythonRemoveTestsDir
python3.9-django-debug-toolbar> Finished executing pythonRemoveTestsDir
python3.9-django-debug-toolbar> running install tests
python3.9-django-debug-toolbar> Creating test database for alias 'default'...
python3.9-django-debug-toolbar> System check identified no issues (0 silenced).
python3.9-django-debug-toolbar> ................................................F...ss....s.....s.s...............................s............................sssssss....
python3.9-django-debug-toolbar> ======================================================================
python3.9-django-debug-toolbar> FAIL: test_cursor_wrapper_asyncio_ctx (tests.panels.test_sql.SQLPanelTestCase)
python3.9-django-debug-toolbar> ----------------------------------------------------------------------
python3.9-django-debug-toolbar> Traceback (most recent call last):
python3.9-django-debug-toolbar>   File "/nix/store/54cz3yrllb9b2bgwkrf3kxrcr0z8yj79-python3.9-asgiref-3.5.0/lib/python3.9/site-packages/asgiref/sync.py", line 204, in __call__
python3.9-django-debug-toolbar>     return call_result.result()
python3.9-django-debug-toolbar>   File "/nix/store/33hlmb4afkk7l2fapfik80m6yknjxq10-python3-3.9.12/lib/python3.9/concurrent/futures/_base.py", line 439, in result
python3.9-django-debug-toolbar>     return self.__get_result()
python3.9-django-debug-toolbar>   File "/nix/store/33hlmb4afkk7l2fapfik80m6yknjxq10-python3-3.9.12/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
python3.9-django-debug-toolbar>     raise self._exception
python3.9-django-debug-toolbar>   File "/nix/store/54cz3yrllb9b2bgwkrf3kxrcr0z8yj79-python3.9-asgiref-3.5.0/lib/python3.9/site-packages/asgiref/sync.py", line 270, in main_wrap
python3.9-django-debug-toolbar>     result = await self.awaitable(*args, **kwargs)
python3.9-django-debug-toolbar>   File "/nix/store/33hlmb4afkk7l2fapfik80m6yknjxq10-python3-3.9.12/lib/python3.9/unittest/mock.py", line 1353, in patched
python3.9-django-debug-toolbar>     return await func(*newargs, **newkeywargs)
python3.9-django-debug-toolbar>   File "/build/source/tests/panels/test_sql.py", line 112, in test_cursor_wrapper_asyncio_ctx
python3.9-django-debug-toolbar>     await asyncio.create_task(task())
python3.9-django-debug-toolbar>   File "/build/source/tests/panels/test_sql.py", line 109, in task
python3.9-django-debug-toolbar>     await sync_to_async(sql_call)()
python3.9-django-debug-toolbar> AssertionError: SQLQueryTriggered not raised
python3.9-django-debug-toolbar> ----------------------------------------------------------------------
python3.9-django-debug-toolbar> Ran 138 tests in 3.773s
python3.9-django-debug-toolbar> FAILED (failures=1, skipped=13)
python3.9-django-debug-toolbar> Destroying test database for alias 'default'...

i don't have familiarity with this from the python perspective, so i'm not sure what I'm supposed to do here other than disabling this test, even though i tried some things patching the code itself...

@tim-schilling
Copy link
Contributor Author

tim-schilling commented May 6, 2022

@yuuyins sorry, I don't have nix installed and I don't have the availability to dive into it. However, I don't think disabling this test is the right move since it's there to verify the functionality. If it's breaking, then there's a problem somewhere.

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