From d8fe26f08249acac08da27b892b8917d6c985e56 Mon Sep 17 00:00:00 2001 From: James Knight Date: Sat, 12 Oct 2024 15:30:59 -0400 Subject: [PATCH] tests: moving the linkcode extension registration in validation For validation runs, support for checking linkcode support added the extension in the primary configuration for all validation tests. This is not required and only needs to be in the extension-specific test; updating its location. Signed-off-by: James Knight --- tests/test_validation.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/test_validation.py b/tests/test_validation.py index a3efb6ca..e299cfdd 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -35,7 +35,6 @@ def setUpClass(cls): space_key = os.getenv(SPACE_ENV_KEY, DEFAULT_TEST_SPACE) cls.config = prepare_conf() cls.config['extensions'].append('sphinx.ext.ifconfig') - cls.config['extensions'].append('sphinx.ext.linkcode') cls.config['confluence_api_token'] = os.getenv(AUTH_ENV_KEY) cls.config['confluence_full_width'] = False cls.config['confluence_page_generation_notice'] = True @@ -60,16 +59,6 @@ def setUpClass(cls): cls.test_key = os.getenv(TESTKEY_ENV_KEY, DEFAULT_TEST_KEY) cls.test_version = os.getenv(TESTKEY_ENV_VERSION, DEFAULT_TEST_VERSION) - def linkcode_resolve(domain, info): - module = info.get('module', None) - if module != 'linkcode_example': - return None - name = info.get('fullname', None) - if not name: - return None - return f'https://example.org/src/{name}' - cls.config['linkcode_resolve'] = linkcode_resolve - # overrides from user try: from validation_test_overrides import config_overrides @@ -308,10 +297,21 @@ def _test_extensions(self, editor): config['extensions'].append('sphinx.ext.graphviz') config['extensions'].append('sphinx.ext.ifconfig') config['extensions'].append('sphinx.ext.inheritance_diagram') + config['extensions'].append('sphinx.ext.linkcode') config['extensions'].append('sphinx.ext.todo') config['todo_include_todos'] = True config['todo_link_only'] = True + def linkcode_resolve(domain, info): + module = info.get('module', None) + if module != 'linkcode_example': + return None + name = info.get('fullname', None) + if not name: + return None + return f'https://example.org/src/{name}' + config['linkcode_resolve'] = linkcode_resolve + # always force png since svgs do not look nice in v2 if editor == 'v2': config['imgmath_image_format'] = 'png'