tests

Multicast Testing Module.

Package containing test suites and utilities for the multicast module.

This package provides comprehensive testing coverage for various multicast functionalities including server operations, data processing, cleanup routines, and exception handling.

For specific test cases, see: - Server operations: test_hear_server.McastServerTestSuite - Data processing: test_hear_data_processing.RecvDataProcessingTestSuite - Cleanup routines: test_hear_cleanup.HearCleanupTestSuite - Exception handling: test_exceptions.ExceptionsTestSuite

Robust imports: These statements import the entire “multicast” module, allowing access to all its functionalities within the test environment. This may be flagged as an intentional cyclic import by pylint. See warning about cyclic-imports here

Testing:

Testcase 0: Load tests fixtures

    >>> import tests as _tests
    >>> _tests.__module__ is not None
    True
    >>> _tests.__package__ is not None
    True
    >>>

Submodules

Package Contents

Functions

loadDocstringsFromModule

Load and return a test suite containing doctests from the specified module.

get_test_suite

Get a test suite based on group and category.

load_tests

Will Load the tests from the project and then attempts to load the doctests too.

Data

__package__

__module__

MINIMUM_ACCEPTANCE_TESTS

EXTRA_TESTS

PERFORMANCE_TESTS

TEST_GROUPS

API

tests.__package__[source]

‘tests’

tests.__module__[source]

‘tests’

tests.loadDocstringsFromModule(module)[source][source]

Load and return a test suite containing doctests from the specified module.

This function attempts to import the doctest module and uses it to find and load all doctests defined in the provided module. If the module is valid and contains doctests, a unittest.TestSuite object is returned containing those tests. If no doctests are found or if an error occurs during the loading process, appropriate messages are printed to the console.

Notes:

  • The function checks if the doctest module is already imported to avoid unnecessary imports.

  • The DocTestFinder is configured with the following options: - verbose=True: Enables verbose output for the test discovery. - recurse=True: Allows the finder to search for doctests in nested functions and classes. - exclude_empty=True: Excludes empty doctests from the results.

  • If no doctests are found in the specified module, a message is printed indicating that no tests were found.

  • Any other exceptions encountered during the loading process are caught and printed to the console.

See Also: - get_test_suite: Function that uses loadDocstringsFromModule to build test suites - load_tests: Function that loads both regular tests and doctests

Args: module (module) – The Python module from which to load doctests. This should be a valid module object that has been imported. If the module is None, the function will return None.

Returns: (unittest.TestSuite or None) – A unittest.TestSuite object containing the doctests found in the specified module. If the module is None, the function returns None.

Raises: ImportError If the doctest module fails to import, an ImportError is raised with a message indicating the failure.

Meta-Testing:

    >>> import multicast
    >>> suite = loadDocstringsFromModule(multicast)  #doctest: +ELLIPSIS
    Finding tests in multicast...
    >>> if suite:
    ...     print(f"Loaded {len(suite._tests)} doctests from "
    ...         f"{multicast.__name__}")  # doctest: +ELLIPSIS
    Loaded ... doctests from ...
    >>>
tests.MINIMUM_ACCEPTANCE_TESTS[source]

None

tests.EXTRA_TESTS[source]

None

tests.PERFORMANCE_TESTS[source]

None

tests.TEST_GROUPS[source]

None

tests.get_test_suite(group=None, category=None)[source][source]

Get a test suite based on group and category.

Args: group (str): Test group (‘mat’, ‘extra’, ‘fuzzing’, ‘performance’) category (str): Specific category within the group

Returns: unittest.TestSuite: The configured test suite

tests.load_tests(loader, tests, pattern)[source][source]

Will Load the tests from the project and then attempts to load the doctests too.

Meta Testing:

Testcase 0: Load test fixtures

    >>> import tests as _tests
    >>>

Testcase 1: Load test fixtures

    >>> import tests as _tests
    >>> _tests.load_tests is not None
    True