diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f094f1d98..777a05add 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,6 @@ jobs: tox: runs-on: ubuntu-latest strategy: - max-parallel: 5 matrix: python-version: - "3.9" @@ -21,25 +20,16 @@ jobs: - "pypy3.9" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Install tox - run: | - python -m pip install --upgrade pip setuptools - pip install --upgrade tox tox-gh-actions - name: Install h2spec - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - .github/workflows/install_h2spec.sh - - name: Initialize tox envs - run: | - tox --parallel auto --notest - - name: Test with tox - run: | - tox --parallel 0 + run: mkdir bin && curl -sSL "https://github.com/summerwind/h2spec/releases/latest/download/h2spec_linux_amd64.tar.gz" | tar -xz --directory ./bin && ./bin/h2spec --version + - name: Install tox + run: pip install tox tox-gh-actions + - name: Run tests on Python ${{ matrix.python-version }} + run: tox - uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/install_h2spec.sh b/.github/workflows/install_h2spec.sh deleted file mode 100755 index fcde8143d..000000000 --- a/.github/workflows/install_h2spec.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# For some reason it helps to have this here. -echo $(curl -s --url https://api.github.com/repos/summerwind/h2spec/releases/latest --header "authorization: Bearer ${GITHUB_TOKEN}") - -# We want to get the latest release of h2spec. We do that by asking the -# Github API for it, and then parsing the JSON for the appropriate kind of -# binary. Happily, the binary is always called "h2spec" so we don't need -# even more shenanigans to get this to work. -TARBALL=$(curl -s --url https://api.github.com/repos/summerwind/h2spec/releases/latest --header "authorization: Bearer ${GITHUB_TOKEN}" | jq --raw-output '.assets[] | .browser_download_url | select(endswith("linux_amd64.tar.gz"))') - -curl -s -L "$TARBALL" -o h2spec.tgz -tar xvf h2spec.tgz -mkdir bin -mv h2spec ./bin/ diff --git a/pyproject.toml b/pyproject.toml index 9035d3955..0830a91d4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -73,7 +73,7 @@ packaging = [ "check-manifest==0.50", "readme-renderer==44.0", "build>=1.2.2,<2", - "twine>=5.1.1,<6", + "twine>=6.1.0,<7", "wheel>=0.45.0,<1", ] @@ -183,9 +183,6 @@ python = """ """ [tool.tox.env_run_base] -pass_env = [ - "GITHUB_*", -] dependency_groups = ["testing"] commands = [ ["python", "-bb", "-m", "pytest", "--cov-report=xml", "--cov-report=term", "--cov=h2", { replace = "posargs", extend = true }] diff --git a/src/h2/stream.py b/src/h2/stream.py index d102b056c..d6f5845c3 100644 --- a/src/h2/stream.py +++ b/src/h2/stream.py @@ -1037,7 +1037,7 @@ def receive_push_promise_in_band(self, events = self.state_machine.process_input( StreamInputs.RECV_PUSH_PROMISE, ) - push_event = cast(PushedStreamReceived, events[0]) + push_event = cast("PushedStreamReceived", events[0]) push_event.pushed_stream_id = promised_stream_id hdr_validation_flags = self._build_hdr_validation_flags(events) @@ -1076,7 +1076,7 @@ def receive_headers(self, events = self.state_machine.process_input(input_) headers_event = cast( - Union[RequestReceived, ResponseReceived, TrailersReceived, InformationalResponseReceived], + "Union[RequestReceived, ResponseReceived, TrailersReceived, InformationalResponseReceived]", events[0], ) @@ -1086,9 +1086,9 @@ def receive_headers(self, ) # We ensured it's not an information response at the beginning of the method. cast( - Union[RequestReceived, ResponseReceived, TrailersReceived], + "Union[RequestReceived, ResponseReceived, TrailersReceived]", headers_event, - ).stream_ended = cast(StreamEnded, es_events[0]) + ).stream_ended = cast("StreamEnded", es_events[0]) events += es_events self._initialize_content_length(headers) @@ -1112,7 +1112,7 @@ def receive_data(self, data: bytes, end_stream: bool, flow_control_len: int) -> "set to %d", self, end_stream, flow_control_len, ) events = self.state_machine.process_input(StreamInputs.RECV_DATA) - data_event = cast(DataReceived, events[0]) + data_event = cast("DataReceived", events[0]) self._inbound_window_manager.window_consumed(flow_control_len) self._track_content_length(len(data), end_stream) @@ -1120,7 +1120,7 @@ def receive_data(self, data: bytes, end_stream: bool, flow_control_len: int) -> es_events = self.state_machine.process_input( StreamInputs.RECV_END_STREAM, ) - data_event.stream_ended = cast(StreamEnded, es_events[0]) + data_event.stream_ended = cast("StreamEnded", es_events[0]) events.extend(es_events) data_event.data = data @@ -1144,7 +1144,7 @@ def receive_window_update(self, increment: int) -> tuple[list[Frame], list[Event # this should be treated as a *stream* error, not a *connection* error. # That means we need to catch the error and forcibly close the stream. if events: - cast(WindowUpdated, events[0]).delta = increment + cast("WindowUpdated", events[0]).delta = increment try: self.outbound_flow_control_window = guard_increment_window( self.outbound_flow_control_window, @@ -1228,7 +1228,7 @@ def stream_reset(self, frame: RstStreamFrame) -> tuple[list[Frame], list[Event]] if events: # We don't fire an event if this stream is already closed. - cast(StreamReset, events[0]).error_code = _error_code_from_int(frame.error_code) + cast("StreamReset", events[0]).error_code = _error_code_from_int(frame.error_code) return [], events