From f27bdcc3ecc5586d562c31e12ffb63617dd78e11 Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Sat, 15 Mar 2025 18:51:26 +0000 Subject: [PATCH 1/3] fix: prettier config inconsistencies (#4571) * chore: run prettier fix No changes just run prettier fix across the code base to ensure formatting abides by the standard. * chore: sync prettier version in pre commit check Update version of prettier version in .pre-commit-config.yaml with that from package.json. * fix: sync pre commit and npm prettier config Sync the config of prettier in the pre commit hook with that of npm so we don't get conflicts between the two. --- .pre-commit-config.yaml | 11 +++- src/schema-validation.jsonc | 5 +- src/test/pep-723/2.toml | 4 +- src/test/prettierrc/.prettierrc.yml | 16 ++--- src/test/prettierrc/prettierrc.json | 60 +++++++++---------- .../poetry-dependencies-no-python.toml | 4 +- 6 files changed, 53 insertions(+), 47 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aae646713d7..07b7bbe8628 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,11 +9,18 @@ repos: types_or: ['yaml', 'json', 'javascript', 'css', 'markdown'] always_run: true additional_dependencies: - - 'prettier@3.4.2' + - 'prettier@3.5.2' - 'prettier-plugin-sort-json@4.0.0' - 'prettier-plugin-toml@2.0.1' pass_filenames: true - args: ['--no-color', '--log-level=warn', '--write'] + args: + [ + '--no-color', + '--log-level=warn', + '--write', + '--config=.prettierrc.cjs', + '--ignore-path=.gitignore', + ] - repo: 'https://github.com/codespell-project/codespell' rev: 'v2.4.1' hooks: diff --git a/src/schema-validation.jsonc b/src/schema-validation.jsonc index 965e0cd5974..606f62cd94d 100644 --- a/src/schema-validation.jsonc +++ b/src/schema-validation.jsonc @@ -992,7 +992,10 @@ "unknownKeywords": ["markdownDescription", "x-intellij-html-description"] }, "partial-pytest.json": { - "unknownKeywords": ["x-tombi-array-values-order", "x-tombi-table-keys-order"] + "unknownKeywords": [ + "x-tombi-array-values-order", + "x-tombi-table-keys-order" + ] }, "partial-setuptools.json": { "unknownFormat": [ diff --git a/src/test/pep-723/2.toml b/src/test/pep-723/2.toml index a5a83f87a0e..b15b28eb538 100644 --- a/src/test/pep-723/2.toml +++ b/src/test/pep-723/2.toml @@ -1,8 +1,6 @@ #:schema ../../schemas/json/pep-723.json requires-python = "" -dependencies = [ - "a-n-plus-b>=0.0.1" -] +dependencies = ["a-n-plus-b>=0.0.1"] [tool.ruff] select = ["RUF001"] diff --git a/src/test/prettierrc/.prettierrc.yml b/src/test/prettierrc/.prettierrc.yml index c0af25574ef..9d8bde16122 100644 --- a/src/test/prettierrc/.prettierrc.yml +++ b/src/test/prettierrc/.prettierrc.yml @@ -6,11 +6,11 @@ tabWidth: 4 semi: false singleQuote: true overrides: - - files: '*.test.js' - options: - semi: true - - files: - - '*.html' - - 'legacy/**/*.js' - options: - tabWidth: 4 + - files: '*.test.js' + options: + semi: true + - files: + - '*.html' + - 'legacy/**/*.js' + options: + tabWidth: 4 diff --git a/src/test/prettierrc/prettierrc.json b/src/test/prettierrc/prettierrc.json index 0ebe536e848..c0ce9ec7fb8 100644 --- a/src/test/prettierrc/prettierrc.json +++ b/src/test/prettierrc/prettierrc.json @@ -1,32 +1,32 @@ { - "arrowParens": "always", - "bracketSameLine": false, - "bracketSpacing": true, - "htmlWhitespaceSensitivity": "css", - "insertPragma": false, - "jsxBracketSameLine": false, - "jsxSingleQuote": false, - "overrides": [ - { - "files": ["*/*.Rmd"], - "options": { - "parser": "markdown" - } - }, - { - "files": ["*/*.type"], - "options": { - "parser": "custom" - } - } - ], - "printWidth": 80, - "proseWrap": "preserve", - "quoteProps": "as-needed", - "requirePragma": false, - "semi": true, - "singleQuote": false, - "tabWidth": 2, - "trailingComma": "all", - "useTabs": false + "arrowParens": "always", + "bracketSameLine": false, + "bracketSpacing": true, + "htmlWhitespaceSensitivity": "css", + "insertPragma": false, + "jsxBracketSameLine": false, + "jsxSingleQuote": false, + "overrides": [ + { + "files": ["*/*.Rmd"], + "options": { + "parser": "markdown" + } + }, + { + "files": ["*/*.type"], + "options": { + "parser": "custom" + } + } + ], + "printWidth": 80, + "proseWrap": "preserve", + "quoteProps": "as-needed", + "requirePragma": false, + "semi": true, + "singleQuote": false, + "tabWidth": 2, + "trailingComma": "all", + "useTabs": false } diff --git a/src/test/pyproject/poetry-dependencies-no-python.toml b/src/test/pyproject/poetry-dependencies-no-python.toml index 2c8b63302a7..9f02758d0a2 100644 --- a/src/test/pyproject/poetry-dependencies-no-python.toml +++ b/src/test/pyproject/poetry-dependencies-no-python.toml @@ -3,9 +3,7 @@ name = "dependencies-no-python" version = "0.1.0" description = "" -authors = [ - {name = "Elvis Presley",email = "theking@example.com"} -] +authors = [{ name = "Elvis Presley", email = "theking@example.com" }] requires-python = ">=3.8" [tool.poetry.dependencies] From 7651bb53698339e5b7ecfd44aa67bb776f6b22a0 Mon Sep 17 00:00:00 2001 From: Gabriel Lopes Rodrigues Date: Sat, 15 Mar 2025 15:53:10 -0300 Subject: [PATCH 2/3] feat: add more valid options for pytest schema (#4568) --- src/schemas/json/partial-pytest.json | 32 ++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/schemas/json/partial-pytest.json b/src/schemas/json/partial-pytest.json index 3ce87333660..ecb88117fbf 100644 --- a/src/schemas/json/partial-pytest.json +++ b/src/schemas/json/partial-pytest.json @@ -177,10 +177,17 @@ "description": "Specifies minimum required pytest version." }, "norecursedirs": { - "type": "array", - "items": { - "type": "string" - }, + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "description": "Sets base name patterns for directories to be skipped during test discovery. Uses fnmatch-style matching. Replaces default patterns.", "x-tombi-array-values-order": "ascending" }, @@ -193,10 +200,17 @@ "x-tombi-array-values-order": "ascending" }, "python_files": { - "type": "array", - "items": { - "type": "string" - }, + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "string" + } + ], "description": "Specifies glob patterns for identifying Python test module files.", "default": ["test_*.py", "*_test.py"], "x-tombi-array-values-order": "ascending" @@ -285,7 +299,7 @@ "default": false } }, - "additionalProperties": false, + "additionalProperties": true, "x-tombi-table-keys-order": "schema" }, "LogLevel": { From b6c19c1ed4b3b2b17137f2f56a45ecfef4e5d03f Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Sat, 15 Mar 2025 18:53:58 +0000 Subject: [PATCH 3/3] fix(pytest): asyncio property errors (#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 --- src/schemas/json/partial-pytest.json | 49 +++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/src/schemas/json/partial-pytest.json b/src/schemas/json/partial-pytest.json index ecb88117fbf..ff80b272f6a 100644 --- a/src/schemas/json/partial-pytest.json +++ b/src/schemas/json/partial-pytest.json @@ -5,7 +5,14 @@ "type": "object", "properties": { "ini_options": { - "$ref": "#/definitions/IniOptions", + "allOf": [ + { + "$ref": "#/definitions/IniOptions" + }, + { + "$ref": "#/definitions/IniOptionsAsyncio" + } + ], "title": "Bridge Configuration Options for `pytest.ini` File", "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`." } @@ -14,6 +21,7 @@ "x-tombi-table-keys-order": "schema", "definitions": { "IniOptions": { + "$comment": "additionalProperties is true because the schema is merged with other schemas", "type": "object", "properties": { "addopts": { @@ -302,6 +310,45 @@ "additionalProperties": true, "x-tombi-table-keys-order": "schema" }, + "IniOptionsAsyncio": { + "$comment": "additionalProperties is true because the schema is merged with other schemas", + "description": "Configuration options for pytest-asyncio.\nhttps://pytest-asyncio.readthedocs.io/en/latest/reference/configuration.html", + "type": "object", + "properties": { + "asyncio_default_fixture_loop_scope": { + "$ref": "#/definitions/AsyncioScope", + "type": "string", + "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" + }, + "asyncio_default_test_loop_scope": { + "$ref": "#/definitions/AsyncioScope", + "type": "string", + "description": "Default event loop scope of asynchronous tests. When this configuration option is unset, it default to function scope", + "default": "function" + }, + "asyncio_mode": { + "type": "string", + "oneOf": [ + { + "const": "auto", + "description": "Automatically handling all async functions by the plugin" + }, + { + "const": "strict", + "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" + } + ], + "description": "Sets the asyncio mode for pytest-asyncio.", + "default": "strict" + } + }, + "additionalProperties": true, + "x-tombi-table-keys-order": "schema" + }, + "AsyncioScope": { + "type": "string", + "enum": ["function", "class", "module", "package", "session"] + }, "LogLevel": { "type": "string", "enum": ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]