Skip to content

Commit 940a4ce

Browse files
committed
Add language to fence
1 parent f791498 commit 940a4ce

File tree

3 files changed

+33
-3
lines changed

3 files changed

+33
-3
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ python:
44
- '3.6'
55
env:
66
matrix:
7+
- TEST_FILENAME=''
78
- TEST_FILENAME=test_add_target.py::TestActiveFlag
89
- TEST_FILENAME=test_add_target.py::TestApplicationMetadata
910
- TEST_FILENAME=test_add_target.py::TestContentTypes
@@ -48,9 +49,8 @@ install:
4849
- travis_retry npm install -g markdownlint-cli
4950
cache: pip
5051
before_script:
51-
- make lint
5252
- python ci/set_secrets_file.py
5353
script:
54-
- pytest --exitfirst -vvv tests/mock_vws/"$TEST_FILENAME" --cov=src --cov=tests
54+
- python ci/run_script.py
5555
after_success:
5656
- codecov

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pip install --editable .[dev]
1414

1515
Insall `npm` dependencies for linting Markdown files:
1616

17-
```
17+
```sh
1818
npm install -g markdownlint-cli
1919
```
2020

ci/run_script.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
"""
2+
Run tests and linters on Travis CI.
3+
"""
4+
5+
import os
6+
import subprocess
7+
from pathlib import Path
8+
9+
import pytest
10+
11+
12+
def run_test(test_filename: str) -> None:
13+
"""
14+
Run pytest with a given filename.
15+
"""
16+
path = Path('tests') / 'mock_vws' / test_filename
17+
pytest.main([
18+
'--exitfirst',
19+
str(path),
20+
'--cov=src',
21+
'--cov=tests',
22+
])
23+
24+
25+
if __name__ == '__main__':
26+
TEST_FILENAME = os.environ.get('TEST_FILENAME')
27+
if TEST_FILENAME:
28+
run_test(test_filename=TEST_FILENAME)
29+
else:
30+
subprocess.check_call(['make', 'lint'])

0 commit comments

Comments
 (0)