tests.test_exceptions

Module Contents

Classes

ExceptionsTestSuite

Test suite for validating the behavior of exception classes in the multicast package.

Data

__module__

API

tests.test_exceptions.__module__[source]

‘tests’

class tests.test_exceptions.ExceptionsTestSuite(methodName='runTest')[source][source]

Bases: context.BasicUsageTestSuite

Test suite for validating the behavior of exception classes in the multicast package.

This suite comprehensively tests both CommandExecutionError and ShutdownCommandReceived classes, verifying:

  • Initialization with various argument combinations

  • Default values and overrides

  • Exception chaining and cause propagation

  • Exit code handling and constraints

The suite extends BasicUsageTestSuite to leverage common test infrastructure and maintain consistency across the test framework.

Initialization

Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.

__module__[source]

‘tests.test_exceptions’

__name__[source]

‘tests.test_exceptions.ExceptionsTestSuite’

test_command_execution_error_with_args() None[source][source]

Test CommandExecutionError initialization with custom message and exit code.

Verifies that both the message and exit code are correctly assigned when explicitly provided during initialization.

test_command_execution_error_default_exit_code() None[source][source]

Test CommandExecutionError initialization with default exit code.

Verifies that the exit code defaults to 1 when only a message is provided.

test_command_execution_error_with_cause() None[source][source]

Test CommandExecutionError initialization with a cause.

Verifies that the error properly chains exceptions when initialized with a cause, maintaining both the cause reference and custom attributes.

test_shutdown_received_error_with_args() None[source][source]

Test ShutdownCommandReceived initialization with custom message and exit code.

Verifies that both the message and exit code are correctly assigned when explicitly provided during initialization.

test_shutdown_received_error_default_exit_code() None[source][source]

Test ShutdownCommandReceived initialization with default exit code.

Verifies that the exit code defaults to 143 when only a message is provided.

test_shutdown_received_error_GIVEN_no_args() None[source][source]

Test ShutdownCommandReceived initialization with default exit code.

Verifies that the exit code defaults to 143 when no arguments are provided. Verifies that the message defaults to ‘SHUTDOWN’ when no arguments are provided.

test_shutdown_received_error_with_cause() None[source][source]

Test ShutdownCommandReceived initialization with a cause.

Verifies that the error properly chains exceptions when initialized with a cause, maintaining both the cause reference and custom attributes.

test_command_execution_error_with_bad_inputs() None[source][source]

Test CommandExecutionError handling of garbage inputs.

Verifies that the class properly handles edge cases and invalid inputs by either raising appropriate exceptions or applying sensible defaults.

test_shutdown_received_error_scenarios() None[source][source]

Test ShutdownCommandReceived across multiple scenarios using parameterized tests.