Skip to content

Commit

Permalink
Merge 8ae019a into 93569d6
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Nov 30, 2020
2 parents 93569d6 + 8ae019a commit 4907540
Show file tree
Hide file tree
Showing 7 changed files with 89 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
@@ -1,3 +1,5 @@
[run]
source = findimports
branch = False
plugins =
coverage_python_version
80 changes: 80 additions & 0 deletions .github/workflows/tests.yml
@@ -0,0 +1,80 @@
name: Tests

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
schedule:
- cron: "0 5 * * 6" # 5:00 UTC every Saturday

jobs:
build:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
matrix:
python-version:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "pypy2"
- "pypy3"

steps:
- name: Git clone
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python-version }}"

- name: Pip cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U setuptools wheel
python -m pip install -U flake8
python -m pip install -U coverage coverage-python-version coveralls
- name: Run flake8
run: flake8 *.py

- name: Run tests
run: coverage run testsuite.py

- name: Check test coverage
run: coverage report -m --fail-under=100

- name: Report to coveralls
run: coveralls
if: "matrix.python-version != '2.7' && matrix.python-version != 'pypy2'"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: ${{ matrix.python-version }}
COVERALLS_PARALLEL: true

finish:
name: Tell Coveralls that we're finished running all parallel jobs
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- run: pip3 install -U coveralls
- run: coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -9,7 +9,7 @@ python:
- pypy
- pypy3
install:
- pip install coverage coveralls
- pip install coverage coverage-python-version coveralls
script:
- coverage run testsuite.py
after_script:
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Expand Up @@ -8,8 +8,7 @@ test: ##: run tests

.PHONY: coverage
coverage: ##: measure test coverage
coverage run testsuite.py
coverage report -m --fail-under=100
tox -e coverage

.PHONY: flake8
flake8: ##: check for style problems
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Expand Up @@ -29,8 +29,8 @@ Licence: GPL v2 or later (https://www.gnu.org/copyleft/gpl.html)

|buildstatus|_ |appveyor|_ |coverage|_

.. |buildstatus| image:: https://travis-ci.com/mgedmin/findimports.svg?branch=master
.. _buildstatus: https://travis-ci.com/mgedmin/findimports
.. |buildstatus| image:: https://github.com/mgedmin/findimports/workflows/tests/badge.svg
.. _buildstatus: https://github.com/mgedmin/findimports/actions?query=workflow%3Atests

.. |appveyor| image:: https://ci.appveyor.com/api/projects/status/github/mgedmin/findimports?branch=master&svg=true
.. _appveyor: https://ci.appveyor.com/project/mgedmin/findimports
Expand Down
2 changes: 1 addition & 1 deletion findimports.py
Expand Up @@ -193,7 +193,7 @@ def processDocstring(self, docstring, lineno):
try:
source = example.source
if not isinstance(source, str):
source = source.encode('UTF-8')
source = source.encode('UTF-8') # pragma: PY2
node = ast.parse(source, filename='<docstring>')
except SyntaxError:
print("{filename}:{lineno}: syntax error in doctest".format(
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Expand Up @@ -10,9 +10,10 @@ commands =
[testenv:coverage]
deps =
coverage
coverage-python-version
commands =
coverage run testsuite.py
coverage report
coverage report -m --fail-under=100

[testenv:flake8]
deps = flake8
Expand Down

0 comments on commit 4907540

Please sign in to comment.