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: Further measures to prevent collisions when running multiple copies of the test suit simultaneously #1650

Open
wants to merge 2 commits into
base: unstable
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/test_bot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio

Check failure on line 1 in tests/test_bot.py

View workflow job for this annotation

GitHub Actions / Pytest Results

test_bot.test_emoji

failed on teardown with "exceptiongroup.ExceptionGroup: errors while tearing down <Module test_bot.py> (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/runner.py", line 340, in from_call
  |     result: Optional[TResult] = func()
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/runner.py", line 240, in <lambda>
  |     lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_hooks.py", line 501, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_manager.py", line 119, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 138, in _multicall
  |     raise exception.with_traceback(exception.__traceback__)
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     teardown.throw(exception)  # type: ignore[union-attr]
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/threadexception.py", line 92, in pytest_runtest_teardown
  |     yield from thread_exception_runtest_hook()
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/threadexception.py", line 63, in thread_exception_runtest_hook
  |     yield
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     teardown.throw(exception)  # type: ignore[union-attr]
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 95, in pytest_runtest_teardown
  |     yield from unraisable_exception_runtest_hook()
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 65, in unraisable_exception_runtest_hook
  |     yield
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     teardown.throw(exception)  # type: ignore[union-attr]
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/logging.py", line 856, in pytest_runtest_teardown
  |     yield from self._runtest_for(item, "teardown")
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/logging.py", line 832, in _runtest_for
  |     yield
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     teardown.throw(exception)  # type: ignore[union-attr]
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/capture.py", line 888, in pytest_runtest_teardown
  |     return (yield)
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 102, in _multicall
  |     res = hook_impl.function(*args)
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/runner.py", line 187, in pytest_runtest_teardown
  |     item.session._setupstate.teardown_exact(nextitem)
  |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/runner.py", line 555, in teardown_exact
  |     raise exceptions[0]
  | exceptiongroup.ExceptionGroup: errors while tearing down <Module test_bot.py> (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/runner.py", line 544, in teardown_exact
    |     fin()
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1046, in finish
    |     raise exceptions[0]
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1035, in finish
    |     fin()
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pytest_asyncio/plugin.py", line 342, in finalizer
    |     event_loop.run_until_complete(async_finalizer())
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/asyncio/base_events.py", line 624, in run_until_complete
    |     self._check_closed()
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
    |     raise RuntimeError('Event loop is closed')
    | RuntimeError: Event loop is closed
    +---------------- 2 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/runner.py", line 544, in teardown_exact
    |     fin()
    |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1049, in finish
    |     raise BaseExceptionGroup(msg, exceptions[::-1])
    | exceptiongroup.ExceptionGroup: errors while tearing down fixture "guild" of <Module test_bot.py> (2 sub-exceptions)
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1035, in finish
      |     fin()
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pytest_asyncio/plugin.py", line 342, in finalizer
      |     event_loop.run_until_complete(async_finalizer())
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/asyncio/base_events.py", line 624, in run_until_complete
      |     self._check_closed()
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
      |     raise RuntimeError('Event loop is closed')
      | RuntimeError: Event loop is closed
      +---------------- 2 ----------------
      | Traceback (most recent call last):
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1035, in finish
      |     fin()
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1046, in finish
      |     raise exceptions[0]
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/_pytest/fixtures.py", line 1035, in finish
      |     fin()
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/site-packages/pytest_asyncio/plugin.py", line 342, in finalizer
      |     event_loop.run_until_complete(async_finalizer())
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/asyncio/base_events.py", line 624, in run_until_complete
      |     self._check_closed()
      |   File "/opt/hostedtoolcache/Python/3.10.14/x64/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
      |     raise RuntimeError('Event loop is closed')
      | RuntimeError: Event loop is closed
      +------------------------------------
import logging
import os
import random
from asyncio import AbstractEventLoop
from contextlib import suppress
from datetime import datetime
Expand Down Expand Up @@ -75,7 +76,7 @@
gw = asyncio.create_task(bot.start_gateway())

await bot._ready.wait()
bot.suffix = github_commit
bot.suffix = github_commit + " - " + hex(random.randint(0, 255))[2:]
log.info(f"Logged in as {bot.user} ({bot.user.id}) -- {bot.suffix}")

yield bot
Expand Down
Loading