runtimeverification / runtimeverification/kontrol

Way to distinguish pytest tests when one function name is a prefix of another

Open
#142 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
122
Forks
16
PR merge metrics
No merged PRs in 30d

Description

Pytest test selection using -k, which is what I have been using to isolate only one test for execution, doesn't work well when there are parentheses in the test name, e.g. "test_foundry_prove[AssertTest.test_assert_false()]", so to select this test I have to use something like poetry run pytest src/tests/integration --verbose -k "test_foundry_prove[AssertTest.test_assert_false". But this doesn't work well when there is another test function in the same contract, say, called test_assert_false_1(), since using this workaround "test_foundry_prove[AssertTest.test_assert_false" will also match this other test.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the selection behavior under src/tests/integration using the reported poetry run pytest command and the parametrized test name. Start by checking how pytest -k parses the brackets and parentheses, then determine a selection method that distinguishes test_assert_false() from test_assert_false_1(). Done means each named test can be isolated without also selecting prefix-matching tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.