From c50ade0a9a5333388d8aae5482509eb4b8d6c02e Mon Sep 17 00:00:00 2001 From: raylu <90059+raylu@users.noreply.github.com> Date: Sun, 7 Apr 2024 14:53:47 -0700 Subject: [PATCH] =?UTF-8?q?travis=20=E2=86=92=20github=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 27 +++++++++++++++++++++++++++ .travis.yml | 23 ----------------------- pigwig/pigwig.py | 4 ++-- 3 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e50ae04 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,27 @@ +# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: CI + +on: + push: + branches: '*' + pull_request: + branches: '*' + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: '3.x' + cache: pip + - name: install + run: pip3 install --progress-bar off ruff coveralls + - name: unittest + run: coverage run --source pigwig --omit 'pigwig/tests/*' -m unittest -v + - name: coveralls + uses: coverallsapp/github-action@v2 + - name: ruff + run: ruff check --output-format=github pigwig blogwig diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index dae444d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: python - -dist: focal -sudo: false - -python: - - "3.6" - - "3.9" - -install: - - pip install --quiet 'pylint<2.5' coveralls - -script: - - coverage run --source pigwig --omit 'pigwig/tests/*' -m unittest -v - - pylint pigwig - -after_success: - coveralls - -notifications: - email: - on_success: change - on_failure: change diff --git a/pigwig/pigwig.py b/pigwig/pigwig.py index 4f2f9b4..6b3177f 100644 --- a/pigwig/pigwig.py +++ b/pigwig/pigwig.py @@ -223,14 +223,14 @@ def main(self, host='0.0.0.0', port=None): @staticmethod def handle_urlencoded(body: BinaryIO, length: int | None, params: dict[str, str]) -> Mapping[str, str | list[str]]: if length is None: - raise exceptions.HTTPException(411, 'length required for x-www-form-urlencoded body') + length = -1 charset = params.get('charset', 'utf-8') return parse_qs(body.read(length).decode(charset)) @staticmethod def handle_json(body: BinaryIO, length: int | None, params: dict[str, str]) -> Any: if length is None: - raise exceptions.HTTPException(411, 'length required for JSON body') + length = -1 charset = params.get('charset', 'utf-8') return json.loads(body.read(length).decode(charset))