Skip to content

Commit 2bd2050

Browse files
committed
Add changelog and documentation
1 parent f5ea0ee commit 2bd2050

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

doc/development_guide/contributor_guide/tests/writing_test.rst

+17
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,23 @@ test runner. The following options are currently supported:
6666
- "except_implementations": List of python implementations on which the test should not run
6767
- "exclude_platforms": List of operating systems on which the test should not run
6868

69+
**Different output for different Python versions**
70+
71+
Sometimes the linting result can change between Python releases. In these cases errors can be marked as conditional.
72+
Supported operators are ``<``, ``<=``, ``>`` and ``>=``.
73+
74+
def some_func() -> X: # <3.14:[undefined-variable]
75+
...
76+
77+
class X: ...
78+
79+
Since the output messages are different, it is necessary to add two separate files for it.
80+
First ``<test-file-name>.314.txt``, this will include the output messages for ``>=3.14``, i.e. should be empty here.
81+
Second ``<test-file-name>.txt``, this will be the default for all other Python versions.
82+
83+
Note, this does only work if the code itself is valid in all tested Python versions.
84+
For new syntax, use ``min_pyver`` / ``max_pyver`` instead.
85+
6986
**Functional test file locations**
7087

7188
For existing checkers, new test cases should preferably be appended to the existing test file.

doc/whatsnew/fragments/10382.internal

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Modified test framework to allow for different test output for different Python versions.
2+
3+
Refs #10382

0 commit comments

Comments
 (0)