Skip to content
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

MAINT: Patch file_regression fixture for Sphinx backwards compatibility #536

Merged
merged 1 commit into from Sep 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 23 additions & 0 deletions tests/conftest.py
Expand Up @@ -257,3 +257,26 @@ def _func(doctree):
return doctree

return _func


# TODO Remove when support for Sphinx<=6 is dropped,
# comparison files will need updating
# alternatively the resolution of https://github.com/ESSS/pytest-regressions/issues/32
@pytest.fixture()
def file_regression(file_regression):
return FileRegression(file_regression)


class FileRegression:
ignores = (" translation_progress=\"{'total': 0, 'translated': 0}\"",)

def __init__(self, file_regression):
self.file_regression = file_regression

def check(self, data, **kwargs):
return self.file_regression.check(self._strip_ignores(data), **kwargs)

def _strip_ignores(self, data):
for ig in self.ignores:
data = data.replace(ig, "")
return data