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

[Tests] RuntimeError: There is no current event loop in thread 'MainThread' #6865

Closed
drew2a opened this issue Apr 12, 2022 · 1 comment · Fixed by #6866
Closed

[Tests] RuntimeError: There is no current event loop in thread 'MainThread' #6865

drew2a opened this issue Apr 12, 2022 · 1 comment · Fixed by #6866

Comments

@drew2a
Copy link
Contributor

drew2a commented Apr 12, 2022

https://github.com/Tribler/tribler/runs/5988589743?check_suite_focus=true

____________________ test_start_tribler_core_no_exceptions _____________________

mocked_core_session = <AsyncMock name='core_session' id='4803055920'>

    @patch('tribler.core.logger.logger.load_logger_config', new=MagicMock())
    @patch('tribler.core.start_core.set_process_priority', new=MagicMock())
    @patch('tribler.core.start_core.check_and_enable_code_tracing', new=MagicMock())
    @patch('asyncio.get_event_loop', new=MagicMock())
    @patch('tribler.core.start_core.TriblerConfig.load', new=MagicMock())
    @patch('tribler.core.start_core.core_session')
    def test_start_tribler_core_no_exceptions(mocked_core_session):
        # test that base logic of tribler core runs without exceptions
>       run_tribler_core_session(1, 'key', Path('.'), False)

src/tribler/core/tests/test_start_core.py:18: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/tribler/core/start_core.py:155: in run_tribler_core_session
    loop.run_until_complete(core_session(config, components=list(components_gen(config))))
src/tribler/core/start_core.py:51: in components_gen
    yield ReporterComponent()
src/tribler/core/components/base.py:204: in __init__
    self.started_event = Event()
../../../hostedtoolcache/Python/3.8.12/x64/lib/python3.8/asyncio/locks.py:[260](https://github.com/Tribler/tribler/runs/5988589743?check_suite_focus=true#step:7:260): in __init__
    self._loop = events.get_event_loop()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

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

    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 and
                not self._local._set_called and
                isinstance(threading.current_thread(), threading._MainThread)):
            self.set_event_loop(self.new_event_loop())
    
        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'.

../../../hostedtoolcache/Python/3.8.12/x64/lib/python3.8/asyncio/events.py:639: RuntimeError

Probably related to #6176

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

Successfully merging a pull request may close this issue.

1 participant