Skip to content

implement tag validation functionality and tests #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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? 👀

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.

1 participant