Skip to content

Commit 9b214f5

Browse files
committed
convert to GitHub Actions and add newer Pythons
1 parent 1e7ddf0 commit 9b214f5

File tree

4 files changed

+82
-30
lines changed

4 files changed

+82
-30
lines changed

.github/workflows/ci.yml

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
name: Python ${{ matrix.python-version }}
8+
runs-on: ${{ matrix.os }}
9+
continue-on-error: ${{ matrix.experimental }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
python-version:
14+
- '2.7'
15+
- '3.5'
16+
- '3.6'
17+
- '3.7'
18+
- '3.8'
19+
- '3.9'
20+
experimental:
21+
- false
22+
os: [ubuntu-latest]
23+
include:
24+
# Python 3.4 is not on ubuntu-latest
25+
- python-version: '3.4'
26+
os: ubuntu-18.04
27+
experimental: false
28+
29+
# Python 3.10 is currently failing, but this may be OK
30+
- python-version: '3.10.0-alpha - 3.10'
31+
experimental: true
32+
33+
steps:
34+
- uses: actions/checkout@v2
35+
36+
- name: Set up Python ${{ matrix.python-version }}
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.python-version }}
40+
41+
- uses: actions/cache@v2
42+
with:
43+
path: ~/.cache/pip
44+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
45+
restore-keys: |
46+
${{ runner.os }}-pip-
47+
48+
- name: Install dependencies
49+
id: install
50+
run: |
51+
set -x
52+
pip install -r requirements.txt
53+
54+
# install mypy on Python 3.6+
55+
if python -c \
56+
'import sys; sys.exit(0 if sys.version_info >= (3, 6) else 1)'; then
57+
pip install -U mypy
58+
echo "::set-output name=mypy::true"
59+
fi
60+
61+
- name: Run pytest
62+
run: |
63+
pytest
64+
65+
- name: Run mypy
66+
if: ${{ steps.install.outputs.mypy }}
67+
run: |
68+
mypy pyannotate_*

.travis.yml

-28
This file was deleted.

pyannotate_tools/fixes/tests/test_annotate_json_py3.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
import tempfile
77
import unittest
88
import sys
9-
from mock import patch
9+
10+
try:
11+
from unittest.mock import patch
12+
except ImportError:
13+
from mock import patch # type: ignore
1014

1115
from lib2to3.tests.test_fixers import FixerTestCase
1216

requirements.txt

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1+
mock; python_version < '3.3'
12
mypy_extensions>=0.3.0
2-
pytest>=3.3.0
3+
pytest>=3.3.0; python_version > '3.5'
4+
# pytest >5.3.0 uses typing.Type from Python 3.5.2
5+
pytest>=3.3.0,<=5.3.0; python_version <= '3.5'
6+
# importlib-metadata is needed for Python 3.5+, but pip does not seem to be
7+
# pinning it to a correct version for Python 3.5 (possibly because it's a
8+
# transitive dependency).
9+
# Python 3.5 support was dropped in importlib-metadata 3.0.0
10+
importlib-metadata>=0.12,<3.0.0; python_version == '3.5'
311
setuptools>=28.8.0
412
six>=1.11.0
513
typing>=3.6.2; python_version < '3.5'

0 commit comments

Comments
 (0)