You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,11 +44,15 @@ You can instead of `error` specify the error code.
44
44
With `# ARG` lines you can also specify command-line arguments that should be passed to the plugin when parsing a file. Can be specified multiple times for several different arguments.
45
45
Generated tests will by default `--select` the error code of the file, which will enable any visitors that can generate that code (and if those visitors can raise other codes they might be raised too). This can be overridden by adding an `# ARG --select=...` line.
46
46
47
-
### `# NOANYIO` and `# NOTRIO`
48
-
Eval files are also evaluated where ~all instances of "trio" is replaced with "anyio" and `--anyio` is prepended to the argument list, to check for compatibility with the [anyio](https://github.com/agronholm/anyio) library - unless they are marked with `# NOANYIO`.
49
-
If a file is marked with `# NOTRIO` it will not replace instances of "trio" with "anyio", and the file will not be run by the normal `eval_files` test generator.
50
-
#### `# ANYIO_NO_ERROR`
51
-
A file which is marked with this will ignore all `# error` or `# TRIO...` comments when running with anyio. Use when an error is trio-specific and replacing "trio" with "anyio" should silence all errors.
47
+
### Library parametrization
48
+
Eval files are evaluated with each supported library. It does this by replacing all instances of the `BASE_LIBRARY` ("trio" by default) with the two other libraries, and setting the corresponding flag (`--anyio` or `--asyncio`).
A file which is marked with this will ignore all `# error` or `# TRIO...` comments when running with anyio. Use when an error is library-specific and replacing all instances means the file should no longer raise any errors.
54
+
### `# NOANYIO`, `# NOTRIO`, `#NOASYNCIO`
55
+
Disables checking a file with the specified library. Should be used somewhat sparingly, and always have a comment motivating its use.
52
56
53
57
## Running pytest outside tox
54
58
If you don't want to bother with tox to quickly test stuff, you'll need to install the following dependencies:
Copy file name to clipboardExpand all lines: tests/eval_files/async111.py
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
# type: ignore
2
2
# ASYNC111: Variable, from context manager opened inside nursery, passed to start[_soon] might be invalidly accessed while in use, due to context manager closing before the nursery. This is usually a bug, and nurseries should generally be the inner-most context manager.
3
3
# It's possible there's an equivalent asyncio construction/gotcha, but methods are differently named, so this file will not raise any errors
4
-
# ASYNCIO_NO_ERROR # no nurseries in asyncio. Though maybe the bug is relevant for TaskGroups
4
+
# nurseries are named taskgroups in asyncio/anyio
5
+
# ASYNCIO_NO_ERROR
6
+
# ANYIO_NO_ERROR
5
7
fromtypingimportAny
6
8
7
9
importtrio
@@ -242,3 +244,9 @@ def myfun(nursery, bar):
242
244
nursery.start(f)
243
245
244
246
# fmt: on
247
+
248
+
# visitor does not care to keep track of the type of nursery/taskgroup, so we
249
+
# raise errors on .create_task() even if it doesn't exist in trio.
0 commit comments