Skip to content

Commit 7099768

Browse files
committed
Fix rest_api_spec xfail mechanism
Not only the file names were an issue, but passing strict to xfail can only be done in the configuration.
1 parent 67dcc3c commit 7099768

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ packages = ["elasticsearch_serverless"]
101101
[tool.pytest]
102102
junit_family = "legacy"
103103
addopts = "-vvv -p no:logging --cov-report=term-missing --cov=elasticsearch_serverless --cov-config=.pyproject.toml"
104+
xfail_strict=true
104105

105106
[tool.isort]
106107
profile = "black"

test_elasticsearch_serverless/test_server/test_rest_api_spec.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -554,11 +554,11 @@ def remove_implicit_resolver(cls, tag_to_remove):
554554
# Now we combine setup, teardown, and test_steps into
555555
# a set of pytest.param() instances
556556
for test_number, test_step in test_numbers_and_steps:
557-
# Build the id from the name of the YAML file and
558-
# the number within that file. Most important step
559-
# is to remove most of the file path prefixes and
560-
# the .yml suffix.
561-
pytest_test_name = yaml_file.rpartition(".")[0].replace(".", "/")
557+
# Build the id from the name of the YAML file and the number within
558+
# that file. Most important step is to remove most of the file path
559+
# prefixes and the .yml suffix.
560+
test_path = "/".join(yaml_file.split("/")[2:])
561+
pytest_test_name = test_path.rpartition(".")[0].replace(".", "/")
562562
for prefix in ("rest-api-spec/", "test/", "free/", "platinum/"):
563563
if pytest_test_name.startswith(prefix):
564564
pytest_test_name = pytest_test_name[len(prefix) :]
@@ -592,6 +592,6 @@ def _pytest_param_sort_key(param: pytest.param) -> Tuple[Union[str, int], ...]:
592592
@pytest.mark.parametrize("test_spec", YAML_TEST_SPECS)
593593
def test_rest_api_spec(test_spec, sync_runner):
594594
if test_spec.get("fail", False):
595-
pytest.xfail("Manually marked as failing in 'FAILING_TESTS'", strict=True)
595+
pytest.xfail("Manually marked as failing in 'FAILING_TESTS'")
596596
sync_runner.use_spec(test_spec)
597597
sync_runner.run()

0 commit comments

Comments
 (0)