Skip to content

Commit a11f0d3

Browse files
authored
chore: relax pytest ini schema (SchemaStore#5139)
The Pytest docs make it clear that only strings and arrays of strings are supported, and anything else is converted into a string. This relaxes some common types which should be safe to implicitly convert to a string. Signed-off-by: JP-Ellis <[email protected]>
1 parent c66376f commit a11f0d3

File tree

1 file changed

+182
-36
lines changed

1 file changed

+182
-36
lines changed

src/schemas/json/partial-pytest.json

Lines changed: 182 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,28 @@
6060
"default": ".pytest_cache"
6161
},
6262
"collect_imported_tests": {
63-
"type": "string",
64-
"enum": ["true", "false"],
63+
"oneOf": [
64+
{
65+
"type": "string",
66+
"enum": ["true", "false"]
67+
},
68+
{
69+
"type": "boolean"
70+
}
71+
],
6572
"description": "Settings this to false will make pytest collect classes/functions from test files _only_ if they are defined in that file (as opposed to imported there).",
6673
"default": "true"
6774
},
6875
"consider_namespace_packages": {
69-
"type": "string",
70-
"enum": ["true", "false"],
76+
"oneOf": [
77+
{
78+
"type": "string",
79+
"enum": ["true", "false"]
80+
},
81+
{
82+
"type": "boolean"
83+
}
84+
],
7185
"description": "Controls if pytest should attempt to identify namespace packages when collecting Python modules.",
7286
"default": "false"
7387
},
@@ -84,8 +98,15 @@
8498
"default": "progress"
8599
},
86100
"disable_test_id_escaping_and_forfeit_all_rights_to_community_support": {
87-
"type": "string",
88-
"enum": ["true", "false"],
101+
"oneOf": [
102+
{
103+
"type": "string",
104+
"enum": ["true", "false"]
105+
},
106+
{
107+
"type": "boolean"
108+
}
109+
],
89110
"description": "pytest by default escapes any non-ascii characters used in unicode strings for the parametrization because it has several downsides. If however you would like to use unicode strings in parametrization and see them in the terminal as is (non-escaped), use this option in your configuration file",
90111
"default": "false"
91112
},
@@ -115,20 +136,42 @@
115136
"default": "skip"
116137
},
117138
"enable_assertion_pass_hook": {
118-
"type": "string",
119-
"enum": ["true", "false"],
139+
"oneOf": [
140+
{
141+
"type": "string",
142+
"enum": ["true", "false"]
143+
},
144+
{
145+
"type": "boolean"
146+
}
147+
],
120148
"description": "Enables the pytest_assertion_pass hook. Make sure to delete any previously generated .pyc cache files.",
121149
"default": "false"
122150
},
123151
"faulthandler_exit_on_timeout": {
124-
"type": "string",
125-
"enum": ["true", "false"],
152+
"oneOf": [
153+
{
154+
"type": "string",
155+
"enum": ["true", "false"]
156+
},
157+
{
158+
"type": "boolean"
159+
}
160+
],
126161
"description": "Exit the pytest process after the per-test timeout is reached by passing exit=True to the faulthandler.dump_traceback_later() function. This is particularly useful to avoid wasting CI resources for test suites that are prone to putting the main Python interpreter into a deadlock state.",
127162
"default": "false"
128163
},
129164
"faulthandler_timeout": {
130-
"type": "string",
131-
"pattern": "^[0-9]+$",
165+
"oneOf": [
166+
{
167+
"type": "string",
168+
"pattern": "^[0-9]+$"
169+
},
170+
{
171+
"type": "integer",
172+
"minimum": 0
173+
}
174+
],
132175
"description": "Dumps the tracebacks of all threads if a test takes longer than X seconds to run (including fixture setup and teardown). Implemented using the faulthandler.dump_traceback_later() function, so all caveats there apply."
133176
},
134177
"filterwarnings": {
@@ -159,8 +202,15 @@
159202
"default": "xunit2"
160203
},
161204
"junit_log_passing_tests": {
162-
"type": "string",
163-
"enum": ["true", "false"],
205+
"oneOf": [
206+
{
207+
"type": "string",
208+
"enum": ["true", "false"]
209+
},
210+
{
211+
"type": "boolean"
212+
}
213+
],
164214
"description": "If junit_logging is enabled, configures if the captured output should be written to the JUnit XML file for passing tests.",
165215
"default": "true"
166216
},
@@ -184,12 +234,23 @@
184234
{
185235
"type": "string",
186236
"pattern": "^[0-9]+$"
237+
},
238+
{
239+
"type": "integer",
240+
"minimum": 0
187241
}
188242
]
189243
},
190244
"log_cli": {
191-
"type": "string",
192-
"enum": ["true", "false"],
245+
"oneOf": [
246+
{
247+
"type": "string",
248+
"enum": ["true", "false"]
249+
},
250+
{
251+
"type": "boolean"
252+
}
253+
],
193254
"description": "Enable log display during test run (also known as \"live logging\").",
194255
"default": "false"
195256
},
@@ -352,32 +413,67 @@
352413
"x-tombi-array-values-order": "ascending"
353414
},
354415
"strict": {
355-
"type": "string",
356-
"enum": ["true", "false"],
416+
"oneOf": [
417+
{
418+
"type": "string",
419+
"enum": ["true", "false"]
420+
},
421+
{
422+
"type": "boolean"
423+
}
424+
],
357425
"description": "If set to true, enable 'strict mode', which enables a number of other strict options.",
358426
"default": "false"
359427
},
360428
"strict_config": {
361-
"type": "string",
362-
"enum": ["true", "false"],
429+
"oneOf": [
430+
{
431+
"type": "string",
432+
"enum": ["true", "false"]
433+
},
434+
{
435+
"type": "boolean"
436+
}
437+
],
363438
"description": "If set to true, any warnings encountered while parsing the pytest section of the configuration file will raise errors.",
364439
"default": "false"
365440
},
366441
"strict_markers": {
367-
"type": "string",
368-
"enum": ["true", "false"],
442+
"oneOf": [
443+
{
444+
"type": "string",
445+
"enum": ["true", "false"]
446+
},
447+
{
448+
"type": "boolean"
449+
}
450+
],
369451
"description": "If set to true, markers not registered in the markers section of the configuration file will raise errors.",
370452
"default": "false"
371453
},
372454
"strict_parametrization_ids": {
373-
"type": "string",
374-
"enum": ["true", "false"],
455+
"oneOf": [
456+
{
457+
"type": "string",
458+
"enum": ["true", "false"]
459+
},
460+
{
461+
"type": "boolean"
462+
}
463+
],
375464
"description": "If set to true, pytest emits an error if it detects non-unique parameter set IDs. If not set (the default), pytest automatically handles this by adding 0, 1, … to duplicate IDs, making them unique.",
376465
"default": "false"
377466
},
378467
"strict_xfail": {
379-
"type": "string",
380-
"enum": ["true", "false"],
468+
"oneOf": [
469+
{
470+
"type": "string",
471+
"enum": ["true", "false"]
472+
},
473+
{
474+
"type": "boolean"
475+
}
476+
],
381477
"description": "If set to true, tests marked with @pytest.mark.xfail that actually succeed will by default fail the test suite.",
382478
"default": "false"
383479
},
@@ -397,8 +493,16 @@
397493
"x-tombi-array-values-order": "ascending"
398494
},
399495
"tmp_path_retention_count": {
400-
"type": "string",
401-
"pattern": "^[0-9]+$",
496+
"oneOf": [
497+
{
498+
"type": "string",
499+
"pattern": "^[0-9]+$"
500+
},
501+
{
502+
"type": "integer",
503+
"minimum": 0
504+
}
505+
],
402506
"description": "How many sessions should we keep the tmp_path directories, according to tmp_path_retention_policy.",
403507
"default": "3"
404508
},
@@ -409,14 +513,30 @@
409513
"default": "all"
410514
},
411515
"truncation_limit_chars": {
412-
"type": "string",
413-
"pattern": "^[0-9]+$",
516+
"oneOf": [
517+
{
518+
"type": "string",
519+
"pattern": "^[0-9]+$"
520+
},
521+
{
522+
"type": "integer",
523+
"minimum": 0
524+
}
525+
],
414526
"description": "Controls maximum number of characters to truncate assertion message contents. Setting value to 0 disables the character limit for truncation.",
415527
"default": "640"
416528
},
417529
"truncation_limit_lines": {
418-
"type": "string",
419-
"pattern": "^[0-9]+$",
530+
"oneOf": [
531+
{
532+
"type": "string",
533+
"pattern": "^[0-9]+$"
534+
},
535+
{
536+
"type": "integer",
537+
"minimum": 0
538+
}
539+
],
420540
"description": "Controls maximum number of linesto truncate assertion message contents. Setting value to 0 disables the lines limit for truncation.",
421541
"default": "8"
422542
},
@@ -441,6 +561,10 @@
441561
"type": "string",
442562
"pattern": "^[0-9]+$"
443563
},
564+
{
565+
"type": "integer",
566+
"minimum": 0
567+
},
444568
{
445569
"type": "string",
446570
"enum": ["auto"]
@@ -454,6 +578,10 @@
454578
"type": "string",
455579
"pattern": "^[0-9]+$"
456580
},
581+
{
582+
"type": "integer",
583+
"minimum": 0
584+
},
457585
{
458586
"type": "string",
459587
"enum": ["auto"]
@@ -467,6 +595,10 @@
467595
"type": "string",
468596
"pattern": "^[0-9]+$"
469597
},
598+
{
599+
"type": "integer",
600+
"minimum": 0
601+
},
470602
{
471603
"type": "string",
472604
"enum": ["auto"]
@@ -475,8 +607,15 @@
475607
"description": "Set a verbosity level specifically for test case execution related output, overriding the application wide level."
476608
},
477609
"xfail_strict": {
478-
"type": "string",
479-
"enum": ["true", "false"],
610+
"oneOf": [
611+
{
612+
"type": "string",
613+
"enum": ["true", "false"]
614+
},
615+
{
616+
"type": "boolean"
617+
}
618+
],
480619
"description": "DEPRECATED. Alias for strict_xfail. If true, test suite will fail if a test marked with `@pytest.mark.xfail` unexpectedly passes.",
481620
"deprecated": true,
482621
"default": "false"
@@ -503,8 +642,15 @@
503642
"default": "function"
504643
},
505644
"asyncio_debug": {
506-
"type": "string",
507-
"enum": ["true", "false"],
645+
"oneOf": [
646+
{
647+
"type": "string",
648+
"enum": ["true", "false"]
649+
},
650+
{
651+
"type": "boolean"
652+
}
653+
],
508654
"description": "Enables asyncio debug mode for the default event loop used by asynchronous tests and fixtures.",
509655
"default": "false"
510656
},

0 commit comments

Comments
 (0)