Skip to content

Commit 38f046d

Browse files
committed
Add changelog and documentation
1 parent f5ea0ee commit 38f046d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

doc/development_guide/contributor_guide/tests/writing_test.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,27 @@ 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+
.. code-block:: python
75+
76+
def some_func() -> X: # <3.14:[undefined-variable]
77+
...
78+
79+
class X: ...
80+
81+
Since the output messages are different, it is necessary to add two separate files for it.
82+
First ``<test-file-name>.314.txt``, this will include the output messages for ``>=3.14``, i.e. should be empty here.
83+
Second ``<test-file-name>.txt``, this will be the default for all other Python versions.
84+
85+
.. note::
86+
87+
This does only work if the code itself is valid in all tested Python versions.
88+
For new syntax, use ``min_pyver`` / ``max_pyver`` instead.
89+
6990
**Functional test file locations**
7091

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

doc/whatsnew/fragments/10382.internal

Lines changed: 3 additions & 0 deletions
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)