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
>>>
Testcase 1: Load tests
>>> import tests as _tests
>>> _tests.__module__ is not None
True
>>> import unittest as _unittest
>>> _tests.TEST_GROUPS is not None
True
>>> _tests.get_test_suite is not None
True
>>>
>>> output = _tests.get_test_suite()
>>> output is not None
True
>>> isinstance(output, _unittest.TestSuite)
True
>>>
Submodules
tests.test_depstests.test_recvtests.test_hear_server_activatetests.test_buildtests.test_basictests.test_manifesttests.MulticastUDPClienttests.test_extratests.test_hear_servertests.test_hear_keyboard_interrupttests.test_hear_cleanuptests.test_usagetests.contexttests.test_exceptionstests.run_selectivetests.test_hear_data_processingtests.test_fuzztests.profiling
Package Contents
Functions
Load and return a test suite containing doctests from the specified module. |
|
Get a test suite based on group and category. |
|
Will Load the tests from the project and then attempts to load the doctests too. |
Data
API
- tests.__package__[source]
‘tests’
- tests.__module__[source]
‘tests’
- tests.loadDocstringsFromModule(module: types.ModuleType) unittest.TestSuite[source][source]
Load and return a test suite containing doctests from the specified module.
This function attempts to import the
doctestmodule and uses it to find and load all doctests defined in the provided module. If the module is valid and contains doctests, aunittest.TestSuiteobject 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
doctestmodule is already imported to avoid unnecessary imports.The
DocTestFinderis configured with the following options: -verbose=False: Disables verbose output for the test discovery. (changed in v2.0.9a3) -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
loadDocstringsFromModuleto build test suites - load_tests: Function that loads both regular tests and doctestsArgs: 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.TestSuiteobject containing the doctests found in the specified module. If the module is None, the function returns None.Raises: ImportError If the
doctestmodule fails to import, an ImportError is raised with a message indicating the failure.Meta-Testing:
>>> import multicast >>> suite = loadDocstringsFromModule(multicast) #doctest: +ELLIPSIS >>> 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: Optional[str] = None, category: Optional[str] = None) unittest.TestSuite[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) unittest.TestSuite[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