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

CI croaks on Python 3.12.0a3 #46

Closed
amotl opened this issue Dec 12, 2022 · 3 comments
Closed

CI croaks on Python 3.12.0a3 #46

amotl opened this issue Dec 12, 2022 · 3 comments

Comments

@amotl
Copy link
Contributor

amotl commented Dec 12, 2022

As we can see at 1, running the tests on Python 3.12-dev currently croaks, while it has worked before. See also GH-57.

___________________________ test_find_textual_empty ____________________________

docker_grafana = 'http://127.0.0.1:33333/'
capsys = <_pytest.capture.CaptureFixture object at 0x7f099215e510>

    def test_find_textual_empty(docker_grafana, capsys):
    
        # Run command and capture output.
        set_command("find foobar")
>       grafana_wtf.commands.run()

tests/test_commands.py:46: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
grafana_wtf/commands.py:192: in run
    engine.scan_common()
grafana_wtf/core.py:115: in scan_common
    self.scan_dashboards()
grafana_wtf/core.py:196: in scan_dashboards
    self.fetch_dashboards_parallel()
grafana_wtf/core.py:230: in fetch_dashboards_parallel
    loop = asyncio.get_event_loop()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <asyncio.unix_events._UnixDefaultEventLoopPolicy object at 0x7f0991fc6f90>

    def get_event_loop(self):
        """Get the event loop for the current context.
    
        Returns an instance of EventLoop or raises an exception.
        """
        if self._local._loop is None:
>           raise RuntimeError('There is no current event loop in thread %r.'
                               % threading.current_thread().name)
E           RuntimeError: There is no current event loop in thread 'MainThread'.

/opt/hostedtoolcache/Python/3.12.0-alpha.3/x64/lib/python3.12/asyncio/events.py:676: RuntimeError

Footnotes

  1. https://github.com/panodata/grafana-wtf/actions/runs/3679182061/jobs/6223322780#step:5:59

@amotl
Copy link
Contributor Author

amotl commented Dec 12, 2022

This may have happened due to a new alpha release of Python 3.12. And, indeed:

  • 3.12.0a2 has been released 28 days ago.
  • 3.12.0a3 has been released 6 days ago.

While the GHA Python versions manifest does not reveal any significant information about release dates, we discovered this patch when following python/cpython@v3.12.0a2...v3.12.0a3, and it very much looks like this one is responsible for the observed behavior.

It reads:

get_event_loop() will now raise a RuntimeError if no current event loop was set, instead of creating and setting a new event loop.

/cc @hramezani, @quodt

@amotl
Copy link
Contributor Author

amotl commented Dec 13, 2022

It looks like the removal of the implicit creation of an event loop by get_event_loop() will get postponed to Python 3.14, and the previous behavior will be restored with the next patch release of Python 3.12 alpha.

@amotl amotl changed the title CI croaks on Python 3.12 CI croaks on Python 3.12.0a3 Dec 13, 2022
@amotl
Copy link
Contributor Author

amotl commented Mar 5, 2023

It looks like the issue has been resolved with Python 3.12 alpha 5, indicated by that GH-57 now passes successfully.

-- https://github.com/panodata/grafana-wtf/actions/runs/4333760552/jobs/7567157354

@amotl amotl closed this as completed Mar 5, 2023
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

No branches or pull requests

1 participant