Skip to content

Fix TypeError errors in tests.test_http2_state_machine_completion #18

@MichaelDecent

Description

@MichaelDecent

Summary

tests/test_http2_state_machine_completion.py fails in isolation with multiple TypeError exceptions caused by None values in HTTP/2 limits/settings used by the handler state.

Reproduction

uv run python -m unittest -v tests.test_http2_state_machine_completion

Current result

  • Ran: 13 tests
  • Errors: 10
  • Passes: 3

Representative error signatures

1) Frame header check

TypeError: '>' not supported between instances of 'int' and 'NoneType'

Location:

  • src/tigrcorn/protocols/http2/handler.py:291
  • expression: frame.length > self.state.local_settings[0x5]

2) New remote stream validation

TypeError: '>=' not supported between instances of 'int' and 'NoneType'

Location:

  • src/tigrcorn/protocols/http2/handler.py:366
  • expression: self.streams.active_remote_stream_count() >= self.state.max_concurrent_streams

3) Header fragment size check

TypeError: '>' not supported between instances of 'int' and 'NoneType'

Location:

  • src/tigrcorn/protocols/http2/handler.py:373
  • expression: next_size > self.config.http.http2_max_headers_size

Failing test cases

  • test_client_push_promise_is_rejected
  • test_continuation_does_not_interpret_end_stream_flag
  • test_first_frame_after_preface_must_be_settings
  • test_goaway_last_stream_id_must_not_increase
  • test_max_concurrent_streams_are_enforced
  • test_new_stream_after_peer_goaway_is_rejected
  • test_priority_self_dependency_is_rejected
  • test_stream_receive_flow_control_overflow_is_rejected
  • test_window_update_is_thresholded_not_immediate
  • test_window_update_on_closed_stream_is_ignored

Expected behavior

Handler/config state should be initialized with concrete HTTP/2 defaults before comparisons, or checks should guard None and raise protocol/config errors instead of raw TypeError.

Acceptance criteria

  • uv run python -m unittest -v tests.test_http2_state_machine_completion completes without TypeError errors.
  • Failing scenarios either pass or fail with explicit protocol/config exceptions aligned with test intent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions