Skip to content

Conversation

@ak-massa
Copy link

What?

In our project, a lot of people work on one shared documentation and we used a predefined set of tags that are allowed to be put on pages. For this, it would be nice to have a functionality that fails the build if tags outside of the predefined set of allowed tags are used.

How?

implementation works so far, however the negative test cases only pass if they are run individually...

pytest test/test_validation_tags.py::test_allowed_tag_names_regex_error 
pytest test/test_validation_tags.py::test_minimum_error 
pytest test/test_validation_tags.py::test_maximum_error 

...but not when run with pytest.

FAILED test/test_validation_tags.py::test_allowed_tag_names_regex_error - Failed: DID NOT RAISE <class 'sphinx.errors.ExtensionError'>
FAILED test/test_validation_tags.py::test_minimum_error - Failed: DID NOT RAISE <class 'sphinx.errors.ExtensionError'>
FAILED test/test_validation_tags.py::test_maximum_error - Failed: DID NOT RAISE <class 'sphinx.errors.ExtensionError'>

behavior appears on python v3.12.9. JetBrains Rider 2024.3 pytest testrunner shows the same behavior.

I can't for the life of me figure out why that is (or how to adapt the negative cases to use either status.getValue() or the TagLinks.validate() method directly, similar to the test_empty_taglinks test in test_general_tags). Maybe one of you is smarter than me and knows what my mistake is. 😬

@ak-massa
Copy link
Author

ak-massa commented Mar 3, 2025

Hi @melissawm, any chance you can take a look? 👀

@CyclingNinja
Copy link

CyclingNinja commented Oct 14, 2025

Hi @ak-massa we also wanted this functionality so I had a dig round. ak-massa#1 this is the PR link to your repo to sort it, hopefully we can get this merged soon.

I also pulled from upstream/main to hopefully sort out the conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants