tests package¶

Submodules¶

tests.test_architecture_data module¶

Test all architecture definitions, detection and architecture-specific groups.

tests.test_architecture_data.test_architecture_data_sorting()[source]¶

Architecture instances must be sorted alphabetically.

tests.test_architecture_data.test_architecture_detection()[source]¶
tests.test_architecture_data.test_architecture_logical_grouping()[source]¶
tests.test_architecture_data.test_no_missing_architecture_in_groups()[source]¶

Check all architecture are attached to at least one non-overlapping group.

tests.test_ci_data module¶

Test all CI definitions, detection and CI-specific groups.

tests.test_ci_data.github_runner_os()[source]¶

Returns the OS name as defined in the GitHub Actions matrix context.

Caution

This only works when running inside a GitHub Actions job that uses a matrix strategy with an os variant. Which is the case for the extra-platforms workflows.

Return type:

str | None

tests.test_ci_data.test_ci_data_sorting()[source]¶

CI instances must be sorted alphabetically.

tests.test_ci_data.test_github_runner_detection()[source]¶

Test GitHub runner OS.

List of available GitHub runner images: https://github.com/actions/runner-images#available-images

tests.test_ci_data.test_ci_detection()[source]¶
tests.test_ci_data.test_ci_logical_grouping()[source]¶
tests.test_ci_data.test_no_missing_ci_in_groups()[source]¶

Check all CI are attached to at least one non-overlapping group.

tests.test_deprecated module¶

tests.test_deprecated.test_deprecated_proxy_operations(operation, target, old_name, new_name, operation_func, expected, expects_warning)[source]¶

Test that _DeprecatedProxy delegates various operations.

tests.test_deprecated.test_make_deprecated_proxy()[source]¶

Test the _make_deprecated_proxy factory function.

tests.test_deprecated.test_make_deprecated_callable_with_function()[source]¶

Test _make_deprecated_callable with a real function.

tests.test_deprecated.test_make_deprecated_callable_with_string()[source]¶

Test _make_deprecated_callable with a string (lazy lookup).

tests.test_deprecated.test_all_platform_ids_alias()[source]¶

Test ALL_PLATFORM_IDS → ALL_TRAIT_IDS alias.

tests.test_deprecated.test_all_platforms_without_ci_alias()[source]¶

Test ALL_PLATFORMS_WITHOUT_CI → ALL_PLATFORMS alias.

tests.test_deprecated.test_unknown_linux_alias()[source]¶

Test UNKNOWN_LINUX → UNKNOWN_PLATFORM alias.

tests.test_deprecated.test_any_arm_alias()[source]¶

Test ANY_ARM → ALL_ARM alias.

tests.test_deprecated.test_any_mips_alias()[source]¶

Test ANY_MIPS → ALL_MIPS alias.

tests.test_deprecated.test_any_sparc_alias()[source]¶

Test ANY_SPARC → ALL_SPARC alias.

tests.test_deprecated.test_any_windows_alias()[source]¶

Test ANY_WINDOWS → ALL_WINDOWS alias.

tests.test_deprecated.test_current_os_alias()[source]¶

Test current_os() → current_platform() alias.

tests.test_deprecated.test_current_platforms_alias()[source]¶

Test current_platforms() → current_traits() alias.

tests.test_deprecated.test_is_unknown_linux_alias()[source]¶

Test is_unknown_linux() → is_unknown_platform() alias.

tests.test_deprecated.test_group_extract_platforms_deprecated()[source]¶

Test Group._extract_platforms() deprecated method.

tests.test_deprecated.test_deprecated_is_all_functions()[source]¶

Test is_all_* deprecated functions.

tests.test_deprecated.test_deprecated_is_ci_function()[source]¶

Test is_ci() deprecated function.

tests.test_deprecated.test_deprecated_is_other_unix_function()[source]¶

Test is_other_unix() deprecated function.

tests.test_deprecated.test_deprecated_platforms_from_ids()[source]¶

Test platforms_from_ids() → traits_from_ids() alias.

tests.test_detection module¶

tests.test_detection.test_detection_trait_functions(obj)[source]¶
tests.test_detection.test_detection_heuristics_sorting()[source]¶

Detection heuristics must be sorted within each section.

tests.test_detection.test_is_arm_depends_on_arm_variants()[source]¶

Test that is_arm() correctly calls ARM variant detection functions.

tests.test_detection.test_detection_functions_cached()[source]¶

Test that detection functions are cached with @cache decorator.

tests.test_detection.test_environment_variable_ci_detection(monkeypatch)[source]¶

Test CI detection based on environment variables.

tests.test_detection.test_detection_no_circular_dependencies()[source]¶

Test that detection functions can all be called without circular dependency issues.

tests.test_group module¶

tests.test_group.test_deduplication()[source]¶
tests.test_group.test_membership()[source]¶
tests.test_group.test_extract_members(items, expected)[source]¶
tests.test_group.test_extract_members_bad_type(item)[source]¶
tests.test_group.test_canonical_property()[source]¶
tests.test_group.test_simple_union()[source]¶
tests.test_group.test_multiple_union()[source]¶
tests.test_group.test_single_intersection()[source]¶
tests.test_group.test_multiple_intersection()[source]¶
tests.test_group.test_single_difference()[source]¶
tests.test_group.test_multiple_difference()[source]¶
tests.test_group.test_symmetric_difference()[source]¶
tests.test_group.test_copy()[source]¶
tests.test_group.test_bool()[source]¶

Test __bool__() method for truth value testing.

tests.test_group.test_add()[source]¶

Test add() method for adding a single trait.

tests.test_group.test_remove()[source]¶

Test remove() method for removing a trait with error checking.

tests.test_group.test_discard()[source]¶

Test discard() method for removing a trait without error.

tests.test_group.test_pop()[source]¶

Test pop() method for removing and returning a trait.

tests.test_group.test_clear()[source]¶

Test clear() method for emptying a group.

tests.test_group.test_in_place_operators()[source]¶

Test in-place operators that return new instances.

tests.test_group.test_set_operations_with_new_methods()[source]¶

Test combining new methods with existing set operations.

tests.test_group.test_extract_members_with_unsupported_type()[source]¶

Test that _extract_members raises TypeError for unsupported types.

tests.test_group.test_getitem_with_missing_key()[source]¶

Test that __getitem__ raises KeyError with proper message.

tests.test_group.test_empty_group_bool()[source]¶

Test that empty groups evaluate to False.

tests.test_group.test_group_operations_with_empty_groups()[source]¶

Test group operations with empty groups.

tests.test_group.test_group_with_duplicate_members()[source]¶

Test that duplicate members in constructor are deduplicated.

tests.test_group.test_group_contains_with_string()[source]¶

Test Group.__contains__ with string IDs.

tests.test_group.test_group_contains_with_wrong_trait_object()[source]¶

Test that Group.__contains__ checks object identity, not just ID.

tests.test_group.test_group_items()[source]¶

Test Group.items() returns key-value pairs.

tests.test_group.test_group_extract_members_with_none()[source]¶

Test that _extract_members ignores None values.

tests.test_group.test_group_extract_members_nested()[source]¶

Test that _extract_members handles nested structures.

tests.test_group.test_group_fullyintersects()[source]¶

Test fullyintersects method.

tests.test_group.test_group_canonical_property()[source]¶

Test that Group.canonical property works correctly.

tests.test_group.test_unique_ids()[source]¶

Traits and group IDs must be unique.

tests.test_group.randomize_case(strings)[source]¶

Generate variations of strings with different case.

Return type:

set[str]

tests.test_group.test_traits_from_ids(trait_id)[source]¶

Test traits_from_ids with various case variations.

tests.test_group.test_traits_from_ids_group_resolve(group_id)[source]¶

traits_from_ids() can also resolve group IDs.

tests.test_group.test_groups_from_ids(group_id)[source]¶

Test groups_from_ids with various case variations.

tests.test_group.test_reduction(items, expected)[source]¶

Test reduce function with various inputs.

tests.test_group.test_reduce_custom_targets(items, expected)[source]¶

Test reduce with custom target pool.

tests.test_group.test_traits_from_ids_with_invalid_id()[source]¶

Test that traits_from_ids raises ValueError for invalid IDs.

tests.test_group.test_groups_from_ids_with_invalid_id()[source]¶

Test that groups_from_ids raises ValueError for invalid IDs.

tests.test_group.test_traits_from_ids_with_empty_list()[source]¶

Test that traits_from_ids works with empty input.

tests.test_group.test_groups_from_ids_with_empty_list()[source]¶

Test that groups_from_ids works with empty input.

tests.test_group.test_traits_from_ids_with_multiple_valid_ids()[source]¶

Test that traits_from_ids works with multiple valid IDs.

tests.test_group.test_groups_from_ids_with_multiple_valid_ids()[source]¶

Test that groups_from_ids works with multiple valid IDs.

tests.test_group.test_reduce_with_already_minimal_group()[source]¶

Test reduce with groups that cannot be further reduced.

tests.test_group.test_reduce_with_complex_overlap()[source]¶

Test reduce with complex overlapping groups.

tests.test_group.test_reduce_returns_frozenset()[source]¶

Test that reduce always returns a frozenset.

tests.test_group.test_all_ids_constant()[source]¶

Test that ALL_IDS constant contains all trait and group IDs.

tests.test_group.test_all_trait_ids_completeness()[source]¶

Test that ALL_TRAIT_IDS contains IDs from all non-unknown traits.

tests.test_group.test_all_group_ids_completeness()[source]¶

Test that ALL_GROUP_IDS contains IDs from all non-unknown groups.

tests.test_group_data module¶

tests.test_group_data.test_group_class_metadata()[source]¶
tests.test_group_data.test_group_data_ordering()[source]¶

Group instances follow logical order, not alphabetical.

tests.test_group_data.test_group_definitions(group)[source]¶
tests.test_group_data.test_unique_icons()[source]¶

Check all group icons are unique.

tests.test_group_data.test_unknown_group()[source]¶

All members of the UNKNOWN group are unknown traits.

tests.test_group_data.test_sets_of_groups()[source]¶

Test properties of sets of groups, as well as individual groups.

tests.test_group_data.test_non_overlapping_groups()[source]¶

Check non-overlapping groups are mutually exclusive.

tests.test_group_data.test_overlapping_groups()[source]¶

Check all extra groups overlaps with at least one non-overlapping.

tests.test_group_data.test_each_trait_in_exactly_one_canonical_group()[source]¶

Check each trait belongs to exactly one canonical group.

tests.test_group_data.test_canonical_groups_dont_overlap()[source]¶

Test that canonical groups have no members in common with each other.

tests.test_group_data.test_canonical_groups_cover_all_traits()[source]¶

Test that canonical groups together cover all recognized traits.

tests.test_group_data.test_non_overlapping_groups_completeness()[source]¶

Test that NON_OVERLAPPING_GROUPS is properly defined.

tests.test_group_data.test_canonical_group_marker()[source]¶

Test that canonical groups have the ⏄ marker in their documentation.

tests.test_operations module¶

tests.test_platform_data module¶

Test all platform definitions and platform-specific groups.

tests.test_platform_data.test_platform_data_sorting()[source]¶

Platform instances must be sorted alphabetically.

tests.test_platform_data.test_platform_detection()[source]¶
tests.test_platform_data.test_platform_logical_grouping()[source]¶
tests.test_platform_data.test_no_missing_platform_in_groups()[source]¶

Check all platform are attached to at least one non-overlapping group.

tests.test_pytest module¶

tests.test_pytest.test_all_definition()[source]¶
tests.test_pytest.test_type_annotations()[source]¶

Check all @skip_*/@unless_* annotations are defined and sorted.

tests.test_pytest.test_skip_unknown()[source]¶
tests.test_pytest.test_unless_unknown()[source]¶
tests.test_pytest.test_skip_all_architectures()[source]¶
tests.test_pytest.test_unless_any_architecture()[source]¶
tests.test_pytest.test_skip_all_platforms()[source]¶
tests.test_pytest.test_unless_any_platform()[source]¶
tests.test_pytest.test_skip_all_ci()[source]¶
tests.test_pytest.test_unless_any_ci()[source]¶
tests.test_pytest.test_skip_unknown_architecture()[source]¶
tests.test_pytest.test_unless_unknown_architecture()[source]¶
tests.test_pytest.test_skip_unknown_platform()[source]¶
tests.test_pytest.test_unless_unknown_platform()[source]¶
tests.test_pytest.test_skip_unknown_ci()[source]¶
tests.test_pytest.test_unless_unknown_ci()[source]¶
tests.test_pytest.test_skip_linux()[source]¶
tests.test_pytest.test_unless_linux()[source]¶
tests.test_pytest.test_skip_macos()[source]¶
tests.test_pytest.test_unless_macos()[source]¶
tests.test_pytest.test_skip_ubuntu()[source]¶
tests.test_pytest.test_unless_ubuntu()[source]¶
tests.test_pytest.test_skip_windows()[source]¶
tests.test_pytest.test_unless_windows()[source]¶
tests.test_pytest.test_skip_github_ci()[source]¶
tests.test_pytest.test_unless_github_ci()[source]¶
tests.test_pytest.test_deferred_condition_defers_evaluation()[source]¶

Test that _DeferredCondition defers evaluation until needed.

tests.test_pytest.test_deferred_condition_bool()[source]¶

Test that _DeferredCondition.__bool__() calls the condition.

tests.test_pytest.test_deferred_condition_call()[source]¶

Test that _DeferredCondition.__call__() works.

tests.test_pytest.test_deferred_condition_invert_false()[source]¶

Test that _DeferredCondition with invert=False returns the condition result.

tests.test_pytest.test_deferred_condition_invert_true()[source]¶

Test that _DeferredCondition with invert=True inverts the condition result.

tests.test_pytest.test_deferred_condition_with_pytest_skipif()[source]¶

Test that _DeferredCondition works with pytest.mark.skipif.

tests.test_root module¶

tests.test_root.PROJECT_ROOT = PosixPath('/home/runner/work/extra-platforms/extra-platforms')¶

The root path of the project.

tests.test_root.PYPROJECT_PATH = PosixPath('/home/runner/work/extra-platforms/extra-platforms/pyproject.toml')¶

The path to the pyproject.toml file.

tests.test_root.PYPROJECT = {'build-system': {'build-backend': 'uv_build', 'requires': ['uv_build >= 0.9.0']}, 'dependency-groups': {'docs': ['click-extra [sphinx] >= 7.3.0', 'furo >= 2025.9.25', 'myst-parser >= 4.0.0', 'sphinx', 'sphinx-autodoc-typehints >= 2.4.0', 'sphinx-copybutton >= 0.5.2', 'sphinx-design >= 0.6.0', 'sphinx-issues >= 5.0.0', 'sphinxcontrib-mermaid >= 1.2.2', 'sphinxext-opengraph >= 0.13.0', 'tabulate [widechars] >= 0.9', "tomli >= 2.3.0 ; python_version < '3.11'", 'wcmatch >= 10.0'], 'test': ['coverage [toml] >= 7.11.0', 'pytest', 'pytest-cov >= 7.0.0', 'pytest-github-actions-annotate-failures >= 0.3.0', 'pytest-randomly >= 4.0.0', 'pytest-xdist [psutil] >= 3.7.0', 'requests >= 2.32.5', "tomli >= 2.3.0 ; python_version < '3.11'"], 'typing': ['types-requests >= 2.32.4.20250611', 'types-tabulate >= 0.9.0.2']}, 'project': {'authors': [{'email': 'kevin@deldycke.com', 'name': 'Kevin Deldycke'}], 'classifiers': ['Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Environment :: MacOS X', 'Environment :: WebAssembly', 'Environment :: WebAssembly :: Emscripten', 'Environment :: WebAssembly :: WASI', 'Environment :: Win32 (MS Windows)', 'Framework :: Pytest', 'Intended Audience :: Developers', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'Operating System :: Android', 'Operating System :: BeOS', 'Operating System :: MacOS', 'Operating System :: MacOS :: MacOS 9', 'Operating System :: MacOS :: MacOS X', 'Operating System :: Microsoft', 'Operating System :: Microsoft :: MS-DOS', 'Operating System :: Microsoft :: Windows', 'Operating System :: Microsoft :: Windows :: Windows 3.1 or Earlier', 'Operating System :: Microsoft :: Windows :: Windows 7', 'Operating System :: Microsoft :: Windows :: Windows 8', 'Operating System :: Microsoft :: Windows :: Windows 8.1', 'Operating System :: Microsoft :: Windows :: Windows 10', 'Operating System :: Microsoft :: Windows :: Windows 11', 'Operating System :: Microsoft :: Windows :: Windows 95/98/2000', 'Operating System :: Microsoft :: Windows :: Windows CE', 'Operating System :: Microsoft :: Windows :: Windows NT/2000', 'Operating System :: Microsoft :: Windows :: Windows Server 2003', 'Operating System :: Microsoft :: Windows :: Windows Server 2008', 'Operating System :: Microsoft :: Windows :: Windows Vista', 'Operating System :: Microsoft :: Windows :: Windows XP', 'Operating System :: OS Independent', 'Operating System :: OS/2', 'Operating System :: Other OS', 'Operating System :: PDA Systems', 'Operating System :: POSIX', 'Operating System :: POSIX :: AIX', 'Operating System :: POSIX :: BSD', 'Operating System :: POSIX :: BSD :: BSD/OS', 'Operating System :: POSIX :: BSD :: FreeBSD', 'Operating System :: POSIX :: BSD :: NetBSD', 'Operating System :: POSIX :: BSD :: OpenBSD', 'Operating System :: POSIX :: GNU Hurd', 'Operating System :: POSIX :: HP-UX', 'Operating System :: POSIX :: IRIX', 'Operating System :: POSIX :: Linux', 'Operating System :: POSIX :: Other', 'Operating System :: POSIX :: SCO', 'Operating System :: POSIX :: SunOS/Solaris', 'Operating System :: PalmOS', 'Operating System :: RISC OS', 'Operating System :: Unix', 'Operating System :: iOS', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Programming Language :: Python :: 3.13', 'Programming Language :: Python :: 3.14', 'Programming Language :: Python :: Implementation :: CPython', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: System :: Hardware', 'Topic :: System :: Operating System', 'Topic :: System :: Operating System Kernels', 'Topic :: System :: Operating System Kernels :: BSD', 'Topic :: System :: Operating System Kernels :: GNU Hurd', 'Topic :: System :: Operating System Kernels :: Linux', 'Topic :: Utilities', 'Typing :: Typed'], 'dependencies': ['distro >= 1.9.0'], 'description': '🔎 Detect architectures, platforms, and CI systems, grouped by family', 'entry-points': {'pytest11': {'extra-platforms': 'extra_platforms.pytest'}}, 'keywords': ['ALT Linux', 'Amazon Linux', 'Android', 'Arch Linux', 'Architecture detection', 'ARM (32-bit)', 'ARM64 (AArch64)', 'ARMv5TE (little-endian)', 'ARMv6 (little-endian)', 'ARMv7 (little-endian)', 'ARMv8 (32-bit, little-endian)', 'AT&T System Five', 'Azure Pipelines', 'Bamboo', 'Buildkite', 'Buildroot', 'CachyOS', 'CentOS', 'Circle CI', 'Cirrus CI', 'CloudLinux OS', 'CodeBuild', 'Cygwin', 'Debian', 'DragonFly BSD', 'Exherbo Linux', 'Fedora', 'FreeBSD', 'Gentoo Linux', 'GitHub Actions runner', 'GitLab CI', 'GNU/Hurd', 'Guix System', 'Haiku', 'Heroku CI', 'IBM AIX', 'IBM PowerKVM', 'IBM z/Architecture (s390x)', 'illumos', 'Intel 80386 (i386)', 'Intel Pentium (i586)', 'Intel Pentium Pro (i686)', 'KVM for IBM z Systems', 'Linux Mint', 'LoongArch (64-bit)', 'macOS', 'Mageia', 'Mandriva Linux', 'MidnightBSD', 'MIPS (32-bit, big-endian)', 'MIPS (32-bit, little-endian)', 'MIPS64 (big-endian)', 'MIPS64 (little-endian)', 'multiplatform', 'NetBSD', 'Nobara', 'OpenBSD', 'openSUSE', 'openSUSE Tumbleweed', 'Oracle Linux', 'OS detection', 'Parallels', 'Pidora', 'Platform detection', 'PowerPC (32-bit)', 'PowerPC 64-bit (big-endian)', 'PowerPC 64-bit (little-endian)', 'Pytest', 'Raspbian', 'RedHat Enterprise Linux', 'RISC-V (32-bit)', 'RISC-V (64-bit)', 'Rocky Linux', 'Scientific Linux', 'Slackware', 'Solaris', 'SPARC (32-bit)', 'SPARC (64-bit)', 'SunOS', 'SUSE Linux Enterprise Server', 'TeamCity', 'Travis CI', 'Tuxedo OS', 'Ubuntu', 'Ultramarine', 'Unix', 'WebAssembly (32-bit)', 'WebAssembly (64-bit)', 'Windows', 'Windows Subsystem for Linux', 'x86-64 (AMD64)', 'XenServer'], 'license-files': ['license'], 'name': 'extra-platforms', 'optional-dependencies': {'pytest': ['pytest >= 8.2.1']}, 'readme': 'readme.md', 'requires-python': '>= 3.10', 'urls': {'Changelog': 'https://github.com/kdeldycke/extra-platforms/blob/main/changelog.md', 'Documentation': 'https://kdeldycke.github.io/extra-platforms', 'Download': 'https://github.com/kdeldycke/extra-platforms/releases/tag/v8.0.0', 'Funding': 'https://github.com/sponsors/kdeldycke', 'Homepage': 'https://github.com/kdeldycke/extra-platforms', 'Issues': 'https://github.com/kdeldycke/extra-platforms/issues', 'Repository': 'https://github.com/kdeldycke/extra-platforms'}, 'version': '8.0.0'}, 'tool': {'bumpversion': {'allow_dirty': True, 'current_version': '8.0.0', 'files': [{'glob': './**/__init__.py', 'ignore_missing_version': True}, {'filename': './pyproject.toml', 'replace': 'version = "{new_version}"', 'search': 'version = "{current_version}"'}, {'filename': './pyproject.toml', 'replace': 'releases/tag/v{new_version}', 'search': 'releases/tag/v{current_version}'}, {'filename': './changelog.md', 'replace': '## [{new_version} (unreleased)](', 'search': '## [{current_version} (unreleased)]('}, {'filename': './citation.cff', 'replace': 'version: {new_version}', 'search': 'version: {current_version}'}, {'filename': './citation.cff', 'regex': True, 'replace': 'date-released: {utcnow:%Y-%m-%d}', 'search': 'date-released: \\d{{4}}-\\d{{2}}-\\d{{2}}'}]}, 'mypy': {'pretty': True, 'warn_redundant_casts': True, 'warn_return_any': True, 'warn_unreachable': True, 'warn_unused_configs': True, 'warn_unused_ignores': True}, 'pytest': {'ini_options': {'addopts': ['--durations=10', '--cov=extra_platforms', '--cov-branch', '--cov-precision=2', '--cov-report=term', '--cov-report=xml', '--junitxml=junit.xml', '--override-ini=junit_family=legacy'], 'xfail_strict': True}}, 'typos': {'default': {'extend-ignore-identifiers-re': ['Tru64', 'PASE', 'Sur']}}, 'uv': {'build-backend': {'module-root': ''}, 'exclude-newer': '1 week'}}}¶

The parsed content of the pyproject.toml file.

tests.test_root.test_pyproject_keywords()[source]¶

Check that keywords in pyproject.toml are correct.

tests.test_root.test_pypoject_classifiers()[source]¶

Check that Trove classifiers in pyproject.toml are correct.

tests.test_root.test_module_root_declarations()[source]¶
tests.test_root.test_current_funcs()[source]¶
tests.test_root.test_current_strict_mode(current_func, all_collection, unknown_constant, trait_type, error_message, monkeypatch)[source]¶

Test that current_*(strict=True) raises an error when unrecognized.

tests.test_root.test_group_membership_funcs()[source]¶
tests.test_root.test_invalidate_caches()[source]¶

Test that invalidate_caches() properly clears all caches.

tests.test_root.test_multiple_architectures_match(monkeypatch)[source]¶

Test RuntimeError when multiple architectures match.

tests.test_root.test_multiple_platforms_match_non_wsl(monkeypatch)[source]¶

Test RuntimeError when multiple non-WSL platforms match.

tests.test_root.test_multiple_ci_systems_match(monkeypatch)[source]¶

Test RuntimeError when multiple CI systems match.

tests.test_root.test_unrecognized_message_format()[source]¶

Test that _unrecognized_message contains expected fields.

tests.test_root.test_invalidate_caches_python_314(monkeypatch)[source]¶

Test that invalidate_caches calls platform.invalidate_caches on Python 3.14+.

tests.test_root.test_invalidate_caches_clears_all_detection_functions()[source]¶

Test that invalidate_caches clears all detection function caches.

tests.test_root.test_invalidate_caches_clears_group_detection_functions()[source]¶

Test that invalidate_caches clears dynamically generated group detection functions.

tests.test_root.test_invalidate_caches_clears_trait_current_property()[source]¶

Test that invalidate_caches clears Trait.current cached_property.

tests.test_sphinx_crossrefs module¶

Tests for Sphinx cross-reference rendering in the real documentation.

These tests verify that cross-references in the built documentation (./docs/html/) resolve to actual links with correct href attributes. Unlike mock-based tests, these catch real regressions in the actual documentation.

tests.test_sphinx_crossrefs.built_docs()[source]¶

Ensure the documentation is built and return the path to the HTML directory.

This fixture builds the documentation if it doesn’t exist or is outdated.

Return type:

Path

tests.test_sphinx_crossrefs.read_html(built_docs, filename)[source]¶

Read an HTML file from the built documentation.

Return type:

str

Find all href values for links containing the given text.

Returns a list of href values for <a> tags that contain the specified text. The function handles nested tags like <a href=”
”><code><span>text</span></code></a>.

Return type:

list[str]

tests.test_sphinx_crossrefs.has_linked_reference(html, text, expected_href_fragment)[source]¶

Check if the HTML contains a link with the given text pointing to the expected href.

Return type:

bool

Args:

html: The HTML content to search. text: The link text to find (e.g., “AARCH64”, “is_linux()”). expected_href_fragment: A fragment that should be in the href (e.g.,

“architectures.html#extra_platforms.AARCH64”).

Returns:

True if a matching link is found.

tests.test_sphinx_crossrefs.test_group_symbols_are_linked(built_docs)[source]¶

Test that group symbols in the table link to their definitions.

tests.test_sphinx_crossrefs.test_group_detection_functions_are_linked(built_docs)[source]¶

Test that detection functions in the table link to detection.html.

tests.test_sphinx_crossrefs.test_pytest_decorator_table_symbols_are_linked(built_docs)[source]¶

Test that symbols in the decorator table link to their definitions.

tests.test_sphinx_crossrefs.test_pytest_decorator_docstrings_have_linked_symbols(built_docs)[source]¶

Test that decorator docstrings contain linked symbols.

tests.test_sphinx_crossrefs.test_detection_table_symbols_are_linked(built_docs)[source]¶

Test that symbols in the detection table link to their definitions.

tests.test_sphinx_crossrefs.test_trait_table_symbols_are_linked(built_docs)[source]¶

Test that trait symbols in the table link to their definitions.

tests.test_sphinx_crossrefs.test_trait_table_detection_functions_are_linked(built_docs)[source]¶

Test that detection functions in the trait table link to detection.html.

tests.test_sphinx_crossrefs.test_platform_symbols_are_linked(built_docs)[source]¶

Test that platform symbols link to their definitions.

tests.test_sphinx_crossrefs.test_platform_detection_functions_are_linked(built_docs)[source]¶

Test that platform detection functions link to detection.html.

tests.test_sphinx_crossrefs.test_architecture_symbols_are_linked(built_docs)[source]¶

Test that architecture symbols link to their definitions.

tests.test_sphinx_crossrefs.test_ci_symbols_are_linked(built_docs)[source]¶

Test that CI symbols link to their definitions.

tests.test_sphinx_crossrefs.test_group_data_references_from_other_pages(built_docs)[source]¶

Test that references to groups from other pages link to groups.html.

tests.test_sphinx_crossrefs.test_detection_references_from_trait_pages(built_docs)[source]¶

Test that detection function refs from trait pages link to detection.html.

Parametrized check: the MyST directive in column 1 renders to a link in column 2.

  • myst is the literal MyST role example as shown in the first column of the Reference matrix (e.g. “{data}`~UBUNTU`”).

  • expected_link is the expected href target used in the rendered second column (e.g. “platforms.html#extra_platforms.UBUNTU”).

tests.test_sphinx_crossrefs.get_expected_page_for_symbol(role, symbol)[source]¶

Determine the expected HTML page for a given symbol.

Return type:

str

Args:

role: The Sphinx role (func, data, class, etc.) symbol: The symbol name (e.g., ‘UBUNTU’, ‘is_linux’, ‘Platform’)

Returns:

The expected HTML filename (e.g., ‘platforms.html’)

tests.test_sphinx_crossrefs.test_get_expected_page_for_symbol_handles_public_api(symbol_name)[source]¶

Test that get_expected_page_for_symbol correctly handles each public symbol.

This test validates that our logic correctly maps every symbol exposed in the public API from both extra_platforms and extra_platforms.pytest modules to the correct documentation page.

Args:

symbol_name: The symbol name (e.g., “UBUNTU”, “is_linux”, “pytest.skip_ubuntu”) is_pytest_decorator: True if this is a pytest decorator, False otherwise

tests.test_sphinx_crossrefs.collect_all_refs()[source]¶

Collect all cross-reference tuples (role, symbol, source_file).

This helper is intentionally executed at collection time to generate parametrization values for the comprehensive cross-reference test.

Return type:

list[tuple[str, str, str]]

tests.test_sphinx_crossrefs.test_all_crossreferences_point_to_correct_pages(built_docs, role, symbol, source_file)[source]¶

Parametrized check that a single cross-reference points to the expected page.

The previous monolithic test iterated over all refs; this parametrized variant runs the same checks per-reference so failures are reported per-item.

tests.test_sphinx_crossrefs.extract_docstring_from_html(html, symbol_id)[source]¶

Extract the docstring text for a symbol from HTML content.

This function is used to verify that custom docstrings are properly rendered in the generated HTML documentation, particularly for frozenset collections where Sphinx’s autodoc would normally show the generic frozenset description.

Return type:

str

Args:

html: The HTML content to search. symbol_id: The symbol ID (e.g., “extra_platforms.ALL_GROUPS” or

“extra_platforms.group_data.ALL_GROUPS”).

Returns:

The docstring text (stripped of HTML tags), or empty string if not found.

tests.test_sphinx_crossrefs.test_frozenset_docstrings_are_custom(built_docs, symbol_name, expected_text_fragment)[source]¶

Test that frozenset collections have custom docstrings, not the generic one.

This test verifies that the frozenset collections (ALL_GROUPS, ALL_TRAIT_IDS, etc.) are documented with their custom docstrings extracted from #: comments rather than the generic frozenset description.

tests.test_sphinx_crossrefs.test_frozenset_docstrings_consistent_across_pages(built_docs, symbol_name, expected_text_fragment)[source]¶

Test that frozenset docstrings are consistent in groups.html.

This test verifies that the same custom docstrings appear in groups.html as in extra_platforms.html.

tests.test_trait module¶

tests.test_trait.test_trait_class_metadata(klass)[source]¶
tests.test_trait.test_all_traits_generated_constants(trait)[source]¶
tests.test_trait.test_detection_function_missing(caplog)[source]¶

tests.test_utils module¶

tests.test_utils.test_recursive_update_basic()[source]¶

Test basic recursive update.

tests.test_utils.test_recursive_update_adds_new_keys()[source]¶

Test that recursive update ignores keys not in first dict.

tests.test_utils.test_recursive_update_strict_mode()[source]¶

Test strict mode raises ValueError for unregistered keys.

tests.test_utils.test_recursive_update_deep_nesting()[source]¶

Test recursive update with deep nesting (3+ levels).

tests.test_utils.test_recursive_update_overwrites_non_dict()[source]¶

Test that non-dict values are overwritten, not merged.

tests.test_utils.test_recursive_update_preserves_original()[source]¶

Test that original dict is modified in place.

tests.test_utils.test_remove_blanks_options(blank_type, tree, remove_kwargs, should_remove)[source]¶

Test removing or keeping different types of blank values.

tests.test_utils.test_remove_blanks_mixed_scenario()[source]¶

Test removing all blank types in a mixed scenario.

tests.test_utils.test_remove_blanks_all_options_disabled()[source]¶

Test that nothing is removed when all options are disabled.

tests.test_utils.test_remove_blanks_recursive_cleanup()[source]¶

Test that nested dicts are cleaned recursively.

tests.test_utils.test_remove_blanks_preserves_non_blank_values()[source]¶

Test that non-blank values of all types are preserved.