From 624a27ac679c8271bce94544158f1e4bd8c9a58d Mon Sep 17 00:00:00 2001 From: Tom Gross Date: Sun, 5 Jul 2020 11:50:20 +0200 Subject: [PATCH] Use github actions --- .github/workflows/pycloud-test.yml | 39 ++++++++++++++++++++++++++++++ .travis.yml | 16 ------------ src/pcloud/tests/conftest.py | 8 +++--- test_requirements.txt | 10 ++++---- 4 files changed, 47 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/pycloud-test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/pycloud-test.yml b/.github/workflows/pycloud-test.yml new file mode 100644 index 0000000..bb460fa --- /dev/null +++ b/.github/workflows/pycloud-test.yml @@ -0,0 +1,39 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.6, 3.7, 3.8] + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r test_requirements.txt + pip install -e . + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 src --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + pytest src --capture=no -v diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 738f77b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,16 +0,0 @@ -language: python -# for Python 3.7 *sigh* -# https://github.com/travis-ci/travis-ci/issues/9069#issuecomment-425720905 -sudo: required -dist: xenial -python: - - 3.6 - - 3.7 -install: - - pip install -r test_requirements.txt -script: - - flake8 src/ - - tox -notifications: - email: - - itconsense@gmail.com diff --git a/src/pcloud/tests/conftest.py b/src/pcloud/tests/conftest.py index 2fe5dab..6d92ea9 100644 --- a/src/pcloud/tests/conftest.py +++ b/src/pcloud/tests/conftest.py @@ -11,12 +11,10 @@ def start_mock_server(): """ Start a mock server on port 5000 """ httpd = MockServer(("", PORT), MockHandler) - httpd_thread = Thread(target=httpd.serve_forever) - httpd_thread.setDaemon(True) + httpd_thread = Thread(target=httpd.serve_forever, daemon=True) httpd_thread.start() print("start") yield start_mock_server print("teardown") - httpd_thread.join(1) - httpd_thread._is_stopped = True - httpd_thread._tstate_lock = None + httpd.shutdown() + httpd_thread.join() diff --git a/test_requirements.txt b/test_requirements.txt index 95be7a6..e0c7bfe 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,5 +1,5 @@ -pytest >= 2.8 -tox -wheel -flake8 -fs +pytest==6.0.1 +pytest-sugar==0.9.4 +wheel==0.34.2 +flake8==3.8.3 +fs==2.4.11