Skip to content

Commit ab78cc0

Browse files
committed
Use tox to drive python tests
1 parent d55161d commit ab78cc0

10 files changed

+23
-7
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ jobs:
88
steps:
99
- checkout
1010
- run:
11-
name: run tests py2
12-
command: python test/check-skip-env/check_skip_env_test.py
13-
- run:
14-
name: run tests py3
15-
command: python3 test/check-skip-env/check_skip_env_test.py
11+
name: run py tests
12+
command: |
13+
cd test
14+
pip install tox
15+
tox
1616
1717
1818
workflows:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ out/
1616
.mypy_cache
1717
*.pyc
1818
__pycache__
19+
.tox

test/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.7.12:3.5.2

test/check-skip-env/check_skip_env_test.py renamed to test/check_skip_env_test.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
import os
2+
import sys
23
import glob
34
import unittest
4-
import subprocess
5+
6+
if sys.version_info[0] < 3:
7+
import subprocess32 as subprocess
8+
else:
9+
import subprocess
510

611

712
class TestCheckSkipEnv(unittest.TestCase):
813
def setUp(self):
914
self.root = get_git_root()
1015
self.hook_script = os.path.join(self.root, 'hooks', 'check_skip_env.py')
11-
self.fixture_dir = os.path.join(self.root, 'test', 'check-skip-env', 'fixtures')
16+
self.fixture_dir = os.path.join(self.root, 'test', 'fixtures')
1217

1318
def _check_success(self, files):
1419
subprocess.run([self.hook_script] + files, check=True)

test/tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[tox]
2+
skipsdist = True
3+
envlist = py27,py35
4+
5+
[testenv]
6+
deps =
7+
pytest
8+
subprocess32; python_version < '3.0'
9+
commands = pytest

0 commit comments

Comments
 (0)