summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Caselli <CaselIT@users.noreply.github.com>2021-10-27 18:02:39 +0200
committerGitHub <noreply@github.com>2021-10-27 18:02:39 +0200
commit1222900157502624f3c9774c81bac1e096ea88b0 (patch)
treea449a8bb94a3582674b1ea1d5624039cb2585f10
parentcf605c0994149b1a1936b3a8a597203fe3fbb62e (diff)
downloadpython-mimeparse-1222900157502624f3c9774c81bac1e096ea88b0.tar.gz
chore: add github actions (#42)
* Add github actions Fixes: #39 * Fix workflow
-rw-r--r--.github/workflows/run-test.yaml72
-rw-r--r--.gitignore1
-rw-r--r--mimeparse.py11
-rwxr-xr-xsetup.py3
-rw-r--r--tox.ini30
5 files changed, 80 insertions, 37 deletions
diff --git a/.github/workflows/run-test.yaml b/.github/workflows/run-test.yaml
new file mode 100644
index 0000000..7328325
--- /dev/null
+++ b/.github/workflows/run-test.yaml
@@ -0,0 +1,72 @@
+name: Run tests
+
+on:
+ push:
+ pull_request:
+
+
+jobs:
+ run-test:
+ name: test-${{ matrix.python-version }}
+ runs-on: "ubuntu-latest"
+ strategy:
+ matrix:
+ python-version:
+ - "3.6"
+ - "3.7"
+ - "3.8"
+ - "3.9"
+ - "3.10"
+ - "pypy-3.7"
+
+ fail-fast: false
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+
+ - name: Set up python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ architecture: ${{ matrix.architecture }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install --upgrade tox setuptools
+ pip list
+
+ - name: Run tests
+ run: |
+ tox
+
+ run-lint:
+ name: lint
+ runs-on: "ubuntu-latest"
+ strategy:
+ matrix:
+ python-version:
+ - "3.10"
+
+ fail-fast: false
+
+ steps:
+ - name: Checkout repo
+ uses: actions/checkout@v2
+
+ - name: Set up python
+ uses: actions/setup-python@v2
+ with:
+ python-version: ${{ matrix.python-version }}
+ architecture: ${{ matrix.architecture }}
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install --upgrade tox setuptools
+ pip list
+
+ - name: Run lint
+ run: |
+ tox -e flake8
diff --git a/.gitignore b/.gitignore
index eee4038..38186f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
dist/
build/
.venv/
+.vscode
diff --git a/mimeparse.py b/mimeparse.py
index 0218553..0de6d57 100644
--- a/mimeparse.py
+++ b/mimeparse.py
@@ -85,14 +85,9 @@ def quality_and_fitness_parsed(mime_type, parsed_ranges):
for (type, subtype, params) in parsed_ranges:
# check if the type and the subtype match
- type_match = (
- type in (target_type, '*') or
- target_type == '*'
- )
- subtype_match = (
- subtype in (target_subtype, '*') or
- target_subtype == '*'
- )
+ type_match = type in (target_type, '*') or target_type == '*'
+
+ subtype_match = subtype in (target_subtype, '*') or target_subtype == '*'
# if they do, assess the "fitness" of this mime_type
if type_match and subtype_match:
diff --git a/setup.py b/setup.py
index 5c34b21..3f10ad3 100755
--- a/setup.py
+++ b/setup.py
@@ -37,8 +37,7 @@ setup(
license="MIT",
author_email="dbtsai@dbtsai.com",
url="https://github.com/dbtsai/python-mimeparse",
- download_url=("https://github.com/dbtsai/python-mimeparse/tarball/" +
- version),
+ download_url=("https://github.com/dbtsai/python-mimeparse/tarball/" + version),
keywords=["mime-type"],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*',
classifiers=[
diff --git a/tox.ini b/tox.ini
index 97c4794..ad40452 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,33 +1,9 @@
[tox]
-envlist = py37,py36,py35,py34,py32,py27,pypy,pypy3,flake8
+envlist = py
[testenv]
-commands = python --version
- ./mimeparse_test.py
-
-[testenv:py37]
-basepython = python3.7
-
-[testenv:py36]
-basepython = python3.6
-
-[testenv:py35]
-basepython = python3.5
-
-[testenv:py34]
-basepython = python3.4
-
-[testenv:py32]
-basepython = python3.2
-
-[testenv:py27]
-basepython = python2.7
-
-[testenv:pypy]
-basepython = pypy
-
-[testenv:pypy3]
-basepython = pypy3
+deps = pytest
+commands = pytest
[testenv:flake8]
deps = flake8