Skip to content

Commit

Permalink
travis → github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
raylu committed Apr 7, 2024
1 parent c7aebba commit c50ade0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 25 deletions.
27 changes: 27 additions & 0 deletions .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
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions pigwig/pigwig.py
Expand Up @@ -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))

Expand Down

0 comments on commit c50ade0

Please sign in to comment.