Skip to content

Add ability to run framework tests separately#4538

Merged
jtraglia merged 15 commits into
ethereum:masterfrom
leolara:leolara/improv-tests-framework
Sep 16, 2025
Merged

Add ability to run framework tests separately#4538
jtraglia merged 15 commits into
ethereum:masterfrom
leolara:leolara/improv-tests-framework

Conversation

@leolara

@leolara leolara commented Aug 27, 2025

Copy link
Copy Markdown
Member

These are a set of small improvements suggested by @danceratopz

  • Change a test to pytest that was done in unittest by mistake
  • Change make file so spec tests are not run with infrastructure tests

Comment thread Makefile Outdated
Comment on lines +119 to +135
# Run test framework tests.
#
# To run a specific test, append k=<test>, eg:
# make test k=test_verify_kzg_proof
# To run tests with a specific bls library, append bls=<bls>, eg:
# make test bls=arkworks
test_infra: MAYBE_TEST := $(if $(k),-k=$(k))
# Disable parallelism which running a specific test.
# Parallelism makes debugging difficult (print doesn't work).
test_infra: MAYBE_PARALLEL := $(if $(k),,-n auto)
test_infra: pyspec
@mkdir -p $(TEST_REPORT_DIR)
@$(PYTHON_VENV) -m pytest \
$(MAYBE_PARALLEL) \
--capture=no \
$(MAYBE_TEST) \
$(CURDIR)/tests/infra

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to keep these tests bundled together. make test should run all tests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also, after deleting this, can we fix the typo on line 101:

Disable parallelism which running a specific test.

Should be:

Disable parallelism when running a specific test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to keep these tests bundled together. make test should run all tests.

I think going forward, as more framework tests get added, there would be value in allowing separate execution of these tests:

  1. It creates a clearer separation of intent that makes it immediately clear to a new developer that these "framework tests" have an entirely different purpose.
  2. It allows a developer to iterate faster on framework changes that are covered by fw tests (typically fw tests will run faster than the actual tests).
  3. It allows better reporting, locally, particularly in CI; consensus-specs could have two workflows that would run make tests and make test_infra.

For now, until we improve the CI as in 2., we could add this new test_infra target as a dependency to the test target. This already enables 1. and 2. We can improve the CI in a follow-up PR for 3. and potentially remove the test_infra dep from test.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I understand, but there are better ways of doing this. This solution introduces unnecessary complexity for everyone: (1) we'll need to update documentation telling contributors that they need to run both commands; (2) we need to update the CI checks to run both commands; (3) we'll need to update the release action to run these; (4) we need to update the Makefile help section.

There are two other solutions which I would prefer:

  • Ensure infrastructure tests start with def test_infra_* and use make test k=test_infra.
  • Similar to the current style, make the list of files dynamic and use make test infra-only=true.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I added a TODO list.

Additionally to what @danceratopz said I don't think the normal spec test developer will not need to run the infra tests, so another advantage of having them separated.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No that's not what I'm saying. Seriously, let's not add a separate make command for infrastructure tests. Please.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I pushed ec3edc0 which does it how I think it should be done. Just run make test fw=true.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

After thinking about it some more, I've come to this solution:

  • make test (tests everything)
  • make test component=fw (runs only framework tests)
  • make test component=pyspec (runs only pyspec tests)

Are we okay with this? Does it do what you want it to?

@jtraglia

Copy link
Copy Markdown
Member

Hey Leo, can we give this PR a better title? Something less ambiguous but still <= 50 chars.

@jtraglia jtraglia added the testing CI, actions, tests, testing infra label Aug 27, 2025

@danceratopz danceratopz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Couple of comments below, mainly to explain the motivation for this small change.

Comment thread Makefile Outdated
Comment on lines +119 to +135
# Run test framework tests.
#
# To run a specific test, append k=<test>, eg:
# make test k=test_verify_kzg_proof
# To run tests with a specific bls library, append bls=<bls>, eg:
# make test bls=arkworks
test_infra: MAYBE_TEST := $(if $(k),-k=$(k))
# Disable parallelism which running a specific test.
# Parallelism makes debugging difficult (print doesn't work).
test_infra: MAYBE_PARALLEL := $(if $(k),,-n auto)
test_infra: pyspec
@mkdir -p $(TEST_REPORT_DIR)
@$(PYTHON_VENV) -m pytest \
$(MAYBE_PARALLEL) \
--capture=no \
$(MAYBE_TEST) \
$(CURDIR)/tests/infra

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I want to keep these tests bundled together. make test should run all tests.

I think going forward, as more framework tests get added, there would be value in allowing separate execution of these tests:

  1. It creates a clearer separation of intent that makes it immediately clear to a new developer that these "framework tests" have an entirely different purpose.
  2. It allows a developer to iterate faster on framework changes that are covered by fw tests (typically fw tests will run faster than the actual tests).
  3. It allows better reporting, locally, particularly in CI; consensus-specs could have two workflows that would run make tests and make test_infra.

For now, until we improve the CI as in 2., we could add this new test_infra target as a dependency to the test target. This already enables 1. and 2. We can improve the CI in a follow-up PR for 3. and potentially remove the test_infra dep from test.

Comment thread Makefile Outdated
Comment thread tests/infra/test_template_test.py Outdated
@leolara leolara changed the title Improvements to the tests Separate tests between spec tests and infra tests AND change framework for test_template_test Aug 28, 2025
@jtraglia

Copy link
Copy Markdown
Member

If you're okay with my change, we can merge this after the broken test is fixed.

Also, please update the title & be sure that it's not crazy long.

Hey Leo, can we give this PR a better title? Something less ambiguous but still <= 50 chars.

Comment thread .github/workflows/release.yml Outdated
jtraglia and others added 2 commits August 29, 2025 06:49
Co-authored-by: Leo Lara <leolara@users.noreply.github.com>
@leolara

leolara commented Sep 11, 2025

Copy link
Copy Markdown
Member Author

@jtraglia continue-on-error doesn't work?

@jtraglia

Copy link
Copy Markdown
Member

@jtraglia continue-on-error doesn't work?

It does work but I don't want it to continue. I will not merge anything with failing CI tests & there's no point in running 30+ mins of extra tests. I didn't see this change in your suggestion; I thought it just updated the task name.

@jtraglia

Copy link
Copy Markdown
Member

@leolara could you fix the failing CI checks?

@leolara

leolara commented Sep 15, 2025

Copy link
Copy Markdown
Member Author

@jtraglia please check again

@jtraglia jtraglia changed the title Separate tests between spec tests and infra tests AND change framework for test_template_test Add ability to run framework tests separately Sep 16, 2025
@jtraglia jtraglia merged commit 41a8470 into ethereum:master Sep 16, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing CI, actions, tests, testing infra

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants