Skip to content

Commit f3546a4

Browse files
Improve documentation of test format
There are some advanced edge cases that were indirectly described here or not described at all; this fixes that. This PR conflicts slightly with python#19546 as it documents the current behavior, not the improved behavior that relies less on spaces.
1 parent 1e0ee99 commit f3546a4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

test-data/unit/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ Add the test in this format anywhere in the file:
2929
- `# E: abc...` indicates that this line should result in type check error
3030
with text "abc..."
3131
- note a space after `E:` and `flags:`
32-
- `# E:12` adds column number to the expected error
32+
- `# E:12` adds column number to the expected error. Example: `# E:12: Incompatible [etc...]`.
33+
- ` # ` will normally terminate the error message that comes before it;
34+
this allows for multiple comments on the same line. Example: `# E: [etc...] # This fails`.
3335
- use `\` to escape the `#` character and indicate that the rest of the line is part of
34-
the error message
35-
- repeating `# E: ` several times in one line indicates multiple expected errors in one line
36+
the error message. Example: `# E: This message includes the \# character once :) # new comment`.
37+
- repeating ` # E: ` several times in one line indicates multiple expected errors in one line
3638
- `W: ...` and `N: ...` works exactly like `E: ...`, but report a warning and a note respectively
3739
- lines that don't contain the above should cause no type check errors
3840
- optional `[builtins fixtures/...]` tells the type checker to use
@@ -45,6 +47,8 @@ the test without having to change line numbers in `[out]`
4547
- an empty `[out]` section has no effect
4648
- to add tests for a feature that hasn't been implemented yet, append `-xfail`
4749
to the end of the test name
50+
- to mark a test as to-be-skipped, append `-skip`. For more on the distinction
51+
between xfail and skip, see https://docs.pytest.org/en/stable/how-to/skipping.html
4852
- to run just this test, use `pytest -n0 -k testNewSyntaxBasics`
4953

5054

0 commit comments

Comments
 (0)