conf: add settings for running and skipping specific tests
This commit is contained in:
parent
05cfcd8aee
commit
3a06b7e2bc
4 changed files with 116 additions and 0 deletions
|
@ -12,6 +12,7 @@ from rust2rpm import log
|
|||
TOML_SCHEMA = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
# package properties
|
||||
"package": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -28,11 +29,44 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
},
|
||||
# configure which tests are run
|
||||
"tests": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"run": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": ["none", "all", "lib", "bin", "doc", "bins", "tests"],
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
"skip": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
"skip-exact": {
|
||||
"type": "boolean",
|
||||
},
|
||||
"comments": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
},
|
||||
"additionalProperties": False,
|
||||
"required": ["comments"],
|
||||
},
|
||||
# feature flags passed to cargo
|
||||
"features": {
|
||||
"type": "object",
|
||||
|
@ -46,6 +80,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
# hide feature subpackages
|
||||
|
@ -53,6 +88,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -67,6 +103,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
# additional BuildRequires gated by the "check" bconf
|
||||
|
@ -74,6 +111,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
# additional Requires for the -devel subpackage
|
||||
|
@ -81,6 +119,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
# additional Requires for the binary subpackage
|
||||
|
@ -88,6 +127,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
# additional Requires for feature subpackages
|
||||
|
@ -98,6 +138,7 @@ TOML_SCHEMA = {
|
|||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"uniqueItems": True,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -309,6 +350,34 @@ class TomlConf:
|
|||
else:
|
||||
return None
|
||||
|
||||
@property
|
||||
def _tests(self) -> Optional[dict[str, Any]]:
|
||||
return self._data.get("tests")
|
||||
|
||||
@property
|
||||
def tests_run(self) -> Optional[list[str]]:
|
||||
if tests := self._tests:
|
||||
return tests.get("run")
|
||||
return None
|
||||
|
||||
@property
|
||||
def tests_skip(self) -> Optional[list[str]]:
|
||||
if tests := self._tests:
|
||||
return tests.get("skip")
|
||||
return None
|
||||
|
||||
@property
|
||||
def tests_skip_exact(self) -> Optional[bool]:
|
||||
if tests := self._tests:
|
||||
return tests.get("skip-exact")
|
||||
return None
|
||||
|
||||
@property
|
||||
def tests_comments(self) -> Optional[list[str]]:
|
||||
if tests := self._tests:
|
||||
return tests.get("comments")
|
||||
return None
|
||||
|
||||
@property
|
||||
def _features(self) -> Optional[dict]:
|
||||
return self._data.get("features")
|
||||
|
|
3
rust2rpm/tests/samples/dotenvy-0.15.7.rust2rpm.toml
Normal file
3
rust2rpm/tests/samples/dotenvy-0.15.7.rust2rpm.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[tests]
|
||||
run = ["lib", "tests"]
|
||||
comments = ["files required by doctests are not included in published crates"]
|
8
rust2rpm/tests/samples/reqwest-0.11.20.rust2rpm.toml
Normal file
8
rust2rpm/tests/samples/reqwest-0.11.20.rust2rpm.toml
Normal file
|
@ -0,0 +1,8 @@
|
|||
[tests]
|
||||
skip = [
|
||||
"test_allowed_methods",
|
||||
"test_badssl_modern",
|
||||
"test_badssl_self_signed",
|
||||
]
|
||||
skip-exact = true
|
||||
comments = ["skip tests which require internet access"]
|
|
@ -104,6 +104,23 @@ def test_ini_conf_load(
|
|||
},
|
||||
),
|
||||
),
|
||||
(
|
||||
"dotenvy-0.15.7.rust2rpm.toml",
|
||||
set(),
|
||||
TomlConf(
|
||||
{
|
||||
"tests": {
|
||||
"run": [
|
||||
"lib",
|
||||
"tests",
|
||||
],
|
||||
"comments": [
|
||||
"files required by doctests are not included in published crates",
|
||||
],
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
(
|
||||
"glib-sys-0.17.2.rust2rpm.toml",
|
||||
{"v2_58", "v2_60", "v2_62", "v2_64", "v2_66", "v2_68", "v2_70", "v2_72", "v2_74", "v2_76"},
|
||||
|
@ -156,6 +173,25 @@ def test_ini_conf_load(
|
|||
},
|
||||
),
|
||||
),
|
||||
(
|
||||
"reqwest-0.11.20.rust2rpm.toml",
|
||||
set(),
|
||||
TomlConf(
|
||||
{
|
||||
"tests": {
|
||||
"skip": [
|
||||
"test_allowed_methods",
|
||||
"test_badssl_modern",
|
||||
"test_badssl_self_signed",
|
||||
],
|
||||
"skip-exact": True,
|
||||
"comments": [
|
||||
"skip tests which require internet access",
|
||||
],
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_toml_conf_load(
|
||||
|
|
Loading…
Reference in a new issue