Skip to content

Commit cb2656a

Browse files
authored
Merge pull request #3 from garyp/tox
Run tests using tox in CI
2 parents 9c472af + a16f9ef commit cb2656a

6 files changed

Lines changed: 71 additions & 1 deletion

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
python-version: [2.7]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v2
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
- uses: actions/cache@v2
27+
with:
28+
path: ~/.cache/pip
29+
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}
30+
restore-keys: |
31+
${{ runner.os }}-pip-
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install tox
36+
- name: Test with tox
37+
# Run tox using the version of Python in `PATH`
38+
run: |
39+
tox -e py

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.tox/
12
/build/
23
/dist/
34
/MANIFEST

setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,8 @@
3939
package_data = {
4040
"sifter.t" : ["*.in", "*.out", "*.msg", "*.rules"],
4141
},
42+
install_requires=[
43+
"ply"
44+
],
4245
)
4346

sifter/grammar/comparator.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import re
2+
13
import sifter.comparator
24

35
__all__ = ('Comparator',)

sifter/tests/size.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, arguments=None, tests=None):
2626
}
2727
)
2828
self.validate_tests_size(0)
29-
self.comparison_fn = COMPARISON_FNS[tagged_args['size'][0]]
29+
self.comparison_fn = self.COMPARISON_FNS[tagged_args['size'][0]]
3030
self.comparison_size = tagged_args['size'][1]
3131

3232
def evaluate(self, message, state):

tox.ini

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# tox (https://tox.readthedocs.io/) is a tool for running tests
2+
# in multiple virtualenvs. This configuration file will run the
3+
# test suite on all supported python versions. To use it, "pip install tox"
4+
# and then run "tox" from this directory.
5+
6+
[tox]
7+
envlist = py27
8+
9+
[testenv]
10+
deps = flake8
11+
12+
commands =
13+
# stop the build if there are Python syntax errors or undefined names
14+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
15+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
16+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
17+
18+
python -m unittest discover -v
19+
20+
[flake8]
21+
exclude =
22+
# this is the default list of excludes
23+
.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg,
24+
# auto-generated files
25+
parsetab.py

0 commit comments

Comments
 (0)