Skip to content

fix(ci): All slow unit tests, remove run_in_serial #1870

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

Merged
merged 3 commits into from
Jul 8, 2025
Merged

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Jul 8, 2025

🗒️ Description

--t8n-server-url fill flag

Adds a new flag to t8n in order to be able to pass an already-running t8n server to run unit tests.

This allows us to use a single eels resolver server instance in all unit tests and speed up test running considerably.

Remove run_in_serial

The unit test marker run_in_serial is removed since now all tests can run in parallel without issues.

Improvements

Before

uvx --with=tox-uv tox -e pytest command:

  • pytest -c ./pytest-framework.ini -n auto -m 'not run_in_serial' - 103.30s (0:01:43)
  • pytest -c ./pytest-framework.ini -m run_in_serial - 96.13s (0:01:36)
  • Total - 199.43s (0:03:19)

After

uvx --with=tox-uv tox -e pytest command:

  • pytest -c ./pytest-framework.ini -n auto - 29.46s (0:00:29)
  • Total - 29.46s (0:00:29)

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx --with=tox-uv tox -e lint,typecheck,spellcheck,markdownlint
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered adding an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

@marioevz marioevz requested a review from danceratopz July 8, 2025 00:12
Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Really great idea to share the server across all unit tests 🚀

After merging

I did briefly wonder if we could delete the run_in_serial tests, but then forgot, so thanks a lot for getting on this.

My only nit would be that this exposes a flag in the public CLI, which is not really intended for regular users. I think we should make this clearer in the flags docstring and perhaps add some comments to the fixtures. Otherwise, LGTM!

What follows is not intended within the scope of this PR.

I did wonder if we should do a follow-up PR that adds a ./src/cli/start_server.py? Or add some server auto-start magic to fill, that would unlock this speed-up for regular developement.

E.g.,

# Start server and get URL
SERVER_URL=$(uv run start_server)

# Use in multiple fill commands
uv run fill --t8n-server-url=$SERVER_URL --fork=Prague test1.py
uv run fill --t8n-server-url=$SERVER_URL --fork=Cancun test2.py

# Stop server when done
uv run stop_server $SERVER_URL

But then I realised this won't play so nicely with xdist as-is. See comments below.

What could be even nicer and should be attainable (with a bit of work for xdist) would be something like:

# Start/check servers with auto-management
uv run start_server --daemon -n auto  # starts if not running, prints URL

# Auto-detects existing server
uv run fill --auto-server --fork=Prague test1.py  # uses existing server
uv run fill --auto-server --fork=Cancun test2.py

# Stop daemon
uv run start_server --stop

@marioevz marioevz merged commit a2449bf into main Jul 8, 2025
13 checks passed
@marioevz marioevz deleted the slow-unit-tests branch July 8, 2025 17:06
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.

2 participants