Skip to content

Commit

Permalink
tests: moving the linkcode extension registration in validation
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jdknight committed Oct 12, 2024
1 parent b26ea69 commit d8fe26f
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit d8fe26f

Please sign in to comment.