Skip to content

Commit b6c19c1

Browse files
authored
fix(pytest): asyncio property errors (SchemaStore#4570)
Fix errors flagged due to properties in pytest section of pyproject.toml when asyncio options are configured. The additional properties were defined based off the pytest-asyncio configuration specification here: https://pytest-asyncio.readthedocs.io/en/latest/reference/configuration.html
1 parent 7651bb5 commit b6c19c1

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

src/schemas/json/partial-pytest.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55
"type": "object",
66
"properties": {
77
"ini_options": {
8-
"$ref": "#/definitions/IniOptions",
8+
"allOf": [
9+
{
10+
"$ref": "#/definitions/IniOptions"
11+
},
12+
{
13+
"$ref": "#/definitions/IniOptionsAsyncio"
14+
}
15+
],
916
"title": "Bridge Configuration Options for `pytest.ini` File",
1017
"description": "The `ini_options` table is used as a bridge between the existing `pytest.ini` configuration system and future configuration formats. `pytest.ini` takes precedence over `[tool.pytest.ini_options]` in `pyproject.toml`."
1118
}
@@ -14,6 +21,7 @@
1421
"x-tombi-table-keys-order": "schema",
1522
"definitions": {
1623
"IniOptions": {
24+
"$comment": "additionalProperties is true because the schema is merged with other schemas",
1725
"type": "object",
1826
"properties": {
1927
"addopts": {
@@ -302,6 +310,45 @@
302310
"additionalProperties": true,
303311
"x-tombi-table-keys-order": "schema"
304312
},
313+
"IniOptionsAsyncio": {
314+
"$comment": "additionalProperties is true because the schema is merged with other schemas",
315+
"description": "Configuration options for pytest-asyncio.\nhttps://pytest-asyncio.readthedocs.io/en/latest/reference/configuration.html",
316+
"type": "object",
317+
"properties": {
318+
"asyncio_default_fixture_loop_scope": {
319+
"$ref": "#/definitions/AsyncioScope",
320+
"type": "string",
321+
"description": "Default event loop scope of asynchronous fixtures. When this configuration option is unset, it defaults to the fixture scope. In future versions of pytest-asyncio, the value will default to function when unset"
322+
},
323+
"asyncio_default_test_loop_scope": {
324+
"$ref": "#/definitions/AsyncioScope",
325+
"type": "string",
326+
"description": "Default event loop scope of asynchronous tests. When this configuration option is unset, it default to function scope",
327+
"default": "function"
328+
},
329+
"asyncio_mode": {
330+
"type": "string",
331+
"oneOf": [
332+
{
333+
"const": "auto",
334+
"description": "Automatically handling all async functions by the plugin"
335+
},
336+
{
337+
"const": "strict",
338+
"description": "Auto processing disabling (useful if different async frameworks should be tested together, e.g. both pytest-asyncio and pytest-trio are used in the same project"
339+
}
340+
],
341+
"description": "Sets the asyncio mode for pytest-asyncio.",
342+
"default": "strict"
343+
}
344+
},
345+
"additionalProperties": true,
346+
"x-tombi-table-keys-order": "schema"
347+
},
348+
"AsyncioScope": {
349+
"type": "string",
350+
"enum": ["function", "class", "module", "package", "session"]
351+
},
305352
"LogLevel": {
306353
"type": "string",
307354
"enum": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]

0 commit comments

Comments
 (0)