Repository navigation
Add a framework for functional tests like in pylint - #3484
Draft
Pierre-Sassoulas wants to merge 2 commits into
Draft
Pierre-Sassoulas wants to merge 2 commits into
Pierre-Sassoulas wants to merge 2 commits into
Conversation
Merging this PR will not alter performanceCaution Benchmarks ran in several CI workflows Your benchmarks ran in several CI workflows on this commit, which isn't supported. Move all your benchmark jobs into a single workflow for CodSpeed to work properly.
Comparing Footnotes
|
A file under tests/functional is parsed by astroid and its comments
say what must be found for the node on their line:
Cat().speak() # inferred: Const('meow')
x = foo(1, 2) # value.args[0].inferred: Const(1)
The comment is a path from the node (attributes, indexes, calls with
plain arguments) followed by what it leads to. ``pytest --remaster``
fills in or updates the answers, to be reviewed in the diff.
Like in pylint's functional tests, a ``.rc`` file gates a whole file
(min_pyver, max_pyver, requires, ...), a condition gates one
expectation (``# >=3.14: inferred: ...``) and ``# +1:`` puts an
expectation on the line above the code it is about.
The order of inferred results is not asserted: they are sorted before
being compared. A container is written with its elements.
The comments are read and rewritten by check_inline, from
pytest-remaster 0.2.
The unit tests that only parsed a snippet and asserted on its nodes become 726 annotated files under tests/functional, one directory per test module they come from. Parametrized tests, tests without a snippet and the line and column checks (tests/test_nodes_lineno.py, tests/test_nodes_position.py) stay unit tests.
Pierre-Sassoulas
force-pushed
the
functional-tests
branch
from
November 23, 2026 11:16
e3b0474 to
bd62fe5
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Changes
Description
Add functional tests like in pylint to reduce the boilerplate needed for astroid's test.