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

feat(fw/consume): write the test class & function docstrings to _info["description"] for use in hive reports #579

Merged

Conversation

danceratopz
Copy link
Member

@danceratopz danceratopz commented May 29, 2024

🗒️ Description

This PR:

  • Adds new fields "description" and "url" in the _info section.
    • description contains the current test class and test function docstrings concatenated.
    • url provides a permalink to the test function python source on Github.
  • Uses these new fields and sends it to the Hive Server when creating a new HiveTest in the pytest_hive plugin. This makes a test description available in HiveView.

This will blow up the size of the test fixtures a bit and heavily parametrized fixtures will contain a lot of duplicate information.

This does not attempt to solve the problem of documenting test parametrizations, but this approach could be extended in the future to accommodate for better documentation of parametrized test cases.

Fixture Example

        "_info": {
            "hash": "0x49c7ec7f916b13baf19e826ce163bec98d07cb1ef05820d26f0a3e68d2ffe03e",
            "comment": "`execution-spec-tests` generated test",
            "filling-transition-tool": "evm version 1.14.1-unstable-d6e91e2e-20240507",
            "description": "Test function documentation:\n\n    Fill stack with PUSH0, then OR all values and save using SSTORE.",
            "url": "https://github.com/ethereum/execution-spec-tests/blob/826425cf5b1215f285027746d116c72f04bae44c/tests/shanghai/eip3855_push0/test_push0.py#L75",
            "reference-spec": "https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3855.md",
            "reference-spec-version": "42034250ae8dd4b21fdc6795773893c6f1e74d3a"
        }

Consume/Hive Test Report Description Example

image

Todo

  • Clean-up duplicate info contained in class and function docstrings in the scope of this PR.
  • Test in hiveview.
  • Fix hiveview test display name (just use consume pytest test id).
  • Fix annoying bug introduced in framework tests.

🔗 Related Issues

None

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

@danceratopz danceratopz added type:feat type: Feature scope:fw Scope: Framework (evm|tools|forks|pytest) labels May 29, 2024
@spencer-tb spencer-tb added the scope:consume Scope: Consume command suite label May 30, 2024
Copy link
Collaborator

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this! Added a couple comments :)

src/pytest_plugins/pytest_hive/pytest_hive.py Outdated Show resolved Hide resolved
@danceratopz
Copy link
Member Author

@spencer-tb Here's the size difference in fixture directories with and without "description" and "url" fields. Seems reasonable, imo.

➜ du -hs fixtures-description/ fixtures-main
82M	fixtures-description/
80M	fixtures-main

execution-spec-tests on  main [$!?] via 🐍 310-est-gentest-rpc-refactor 
➜ du -s fixtures-description/ fixtures-main
83748	fixtures-description/
81096	fixtures-main

@marioevz
Copy link
Member

This is awesome 😀

Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

Looking good so far! Some very subtle comments.

src/ethereum_test_tools/utility/versioning.py Outdated Show resolved Hide resolved
src/ethereum_test_tools/utility/versioning.py Outdated Show resolved Hide resolved
@danceratopz danceratopz marked this pull request as ready for review June 4, 2024 13:36
@danceratopz danceratopz requested a review from marioevz June 4, 2024 13:36
Copy link
Member

@marioevz marioevz left a comment

Choose a reason for hiding this comment

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

LGTM!

You can apply or discard the comment I made.

@marioevz marioevz merged commit e80addb into ethereum:main Jun 4, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:consume Scope: Consume command suite scope:fw Scope: Framework (evm|tools|forks|pytest) type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants