Repository: DinoTools/python-overpy (language: python)

Issue:
Add GitHub Actions and set support to Python 2.7,3.6-3.9
##### Issue type
 - Maintenance

##### Summary

Add GitHub Actions CI and set the currently tested versions to 2.7, 3.6, 3.7, 3.8, and 3.9.

I've kept the 2.7, but would like to ask you to consider dropping it. Python 3.6 is the oldest currently supported version, so I have dropped all prior Python 3.x versions.

The results of the GitHub Actions CI won't be immediately visible as it is still not in the `master` branch, but will appear after the merge. 


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..d5ccf7f
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,59 @@
+name: Tests
+
+on:
+  push:
+    branches:
+      - master
+    paths-ignore:
+      - 'docs/**'
+      - '*.md'
+      - '*.rst'
+  pull_request:
+    branches:
+      - master
+    paths-ignore:
+      - 'docs/**'
+      - '*.md'
+      - '*.rst'
+
+jobs:
+  tests:
+    name: "Python ${{ matrix.name }} on ${{ matrix.os }}"
+    runs-on: "${{ matrix.os }}"
+
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - {name: Linux, python: '3.9', os: ubuntu-latest, tox: py39}
+          - {name: Windows, python: '3.9', os: windows-latest, tox: py39}
+          # ToDo: There are errors on Mac, but I don't know why: Connection timeout or reset
+          # - {name: Mac, python: '3.9', os: macos-latest, tox: py39}
+          - {name: '3.8', python: '3.8', os: ubuntu-latest, tox: py38}
+          - {name: '3.7', python: '3.7', os: ubuntu-latest, tox: py37}
+          - {name: '3.6', python: '3.6', os: ubuntu-latest, tox: py36}
+          - {name: 'PyPy', python: pypy3, os: ubuntu-latest, tox: pypy3}
+
+    steps:
+      - uses: "actions/checkout@v2"
+      - uses: "actions/setup-python@v2"
+        with:
+          python-version: ${{ matrix.python }}
+      - name: update pip
+        run: |
+          python -VV
+          python -m site
+          pip install -U wheel
+          pip install -U setuptools
+          python -m pip install -U pip
+      - name: get pip cache dir
+        id: pip-cache
+        run: echo "::set-output name=dir::$(pip cache dir)"
+      - name: cache pip
+        uses: actions/cache@v2
+        with:
+          path: ${{ steps.pip-cache.outputs.dir }}
+          key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}|${{ hashFiles('requirements/*.txt') }}
+      - run: pip install tox
+      - name: "Run tox targets for ${{ matrix.python }}"
+        run: tox -e ${{ matrix.tox }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index ddf968c..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-language: python
-sudo: false
-python:
-  - "2.7"
-  - "3.2"
-  - "3.3"
-  - "3.4"
-  - "3.5"
-  - "3.6"
-  - "pypy"
-  - "pypy3"
-
-before_install:
-  - if [[ $TRAVIS_PYTHON_VERSION == '3.2' ]]; then pip install 'coverage<4.0.0'; fi
-  - pip install coveralls
-
-install:
-  - pip install .
-  - pip install pytest-cov
-
-script:
-  py.test --cov overpy --cov-report=term-missing -v tests/
-
-after_script:
-  coveralls --verbose
diff --git a/README.rst b/README.rst
index bfd5a01..c37c818 100644
--- a/README.rst
+++ b/README.rst
@@ -33,9 +33,8 @@ Install
 
 Supported Python versions:
 
-* Python 2.7
-* Python >= 3.2
-* PyPy and PyPy3
+* Python >= 3.6
+* PyPy3
 
 **Install:**
 
diff --git a/setup.py b/setup.py
index 756d071..6e26a78 100644
--- a/setup.py
+++ b/setup.py
@@ -33,13 +33,11 @@
         "License :: OSI Approved :: MIT License",
         "Operating System :: OS Independent",
         "Programming Language :: Python",
-        "Programming Language :: Python :: 2.7",
         "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.2",
-        "Programming Language :: Python :: 3.3",
-        "Programming Language :: Python :: 3.4",
-        "Programming Language :: Python :: 3.5",
         "Programming Language :: Python :: 3.6",
+        "Programming Language :: Python :: 3.7",
+        "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: Implementation :: CPython",
         "Programming Language :: Python :: Implementation :: PyPy"
     ],
diff --git a/tox.ini b/tox.ini
index abbdf5d..d4360ac 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,6 +1,16 @@
 [tox]
-envlist = py27,py32,py33,py34,py35,py36,pypy,pypy3
+envlist = py36,py37,py38,py39,pypy3
 
 [testenv]
-deps = pytest
-commands = py.test 
+deps =
+    pytest
+    pytest-cov
+commands = pytest --cov overpy --cov-report=term-missing -v tests/
+
+[gh-actions]
+python =
+    3.6: py36
+    3.7: py37
+    3.8: py38
+    3.9: py39
+    pypy3: pypy3


Test patch:
diff --git a/tests/__init__.py b/tests/__init__.py
index 2686eb2..0af614b 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -30,10 +30,6 @@ def get_response(self):
         yield b""
 
 
-class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
-    pass
-
-
 def read_file(filename, mode="r"):
     filename = os.path.join(os.path.dirname(__file__), filename)
     return open(filename, mode).read()
@@ -47,7 +43,7 @@ def new_server_thread(handle_cls, port=None):
         current_port += 1
         test_lock.release()
 
-    server = ThreadedHTTPServer(
+    server = HTTPServer(
         (HOST, port),
         handle_cls
     )