From d02c17e1bbae72751ab2a9303de985c4a56d6d57 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Fri, 3 Dec 2021 07:17:47 +0000 Subject: [PATCH] Add tests for cmdclass --- .../plugins/setuptools.schema.json | 2 +- .../pretend-setuptools/06-pyproject.toml | 3 ++ .../cmdclass/invalid-value.errors.txt | 1 + .../cmdclass/invalid-value.toml | 47 +++++++++++++++++++ 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.errors.txt create mode 100644 tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.toml diff --git a/src/validate_pyproject/plugins/setuptools.schema.json b/src/validate_pyproject/plugins/setuptools.schema.json index debe407..b96ac2d 100644 --- a/src/validate_pyproject/plugins/setuptools.schema.json +++ b/src/validate_pyproject/plugins/setuptools.schema.json @@ -169,7 +169,7 @@ ], "type": "object", "patternProperties": { - "^.*$": {"type": "string", "format": "python_qualified_identifier"} + "^.*$": {"type": "string", "format": "python-qualified-identifier"} } }, "dynamic": { diff --git a/tests/examples/pretend-setuptools/06-pyproject.toml b/tests/examples/pretend-setuptools/06-pyproject.toml index daba52e..0208c89 100644 --- a/tests/examples/pretend-setuptools/06-pyproject.toml +++ b/tests/examples/pretend-setuptools/06-pyproject.toml @@ -39,6 +39,9 @@ platforms = ["any"] [tool.setuptools.packages.find] where = ["src"] +[tool.setuptools.cmdclass] +sdist = "pkg.mod.CustomSdist" + [tool.setuptools.package-data] "myproj.bash" = ["*.sh"] "myproj.yaml" = ["*.yml"] diff --git a/tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.errors.txt b/tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.errors.txt new file mode 100644 index 0000000..ee20c71 --- /dev/null +++ b/tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.errors.txt @@ -0,0 +1 @@ +cmdclass.sdist must be python-qualified-identifier diff --git a/tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.toml b/tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.toml new file mode 100644 index 0000000..bde87e4 --- /dev/null +++ b/tests/invalid-examples/pretend-setuptools/cmdclass/invalid-value.toml @@ -0,0 +1,47 @@ +[project] +name = "project" +description = "description" +license = { text = "BSD-3-Clause" } +dynamic = ["version"] +requires-python = ">= 3.6" + +[[project.author]] +name = "Name 1" +email = "name1@example1.com" + +[[project.author]] +name = "Name 2" +email = "name2@example2.com" + +[project.readme] +file = "README.rst" +content-type = "text/x-rst" + +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +package-dir = {"" = "src"} +include-package-data = true +script-files = [ + "bin/run.py" +] + +[tool.setuptools.cmdclass] +sdist = "pkg.my-invalid:mod.Custom~Sdist" + +[tool.setuptools.packages.find] +where = ["src"] + +[tool.setuptools.dynamic] +version = {file = "__version__.txt"} + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.coverage.paths] +source = [ + "src", + "*/site-packages", +]