File tree Expand file tree Collapse file tree 5 files changed +41
-3
lines changed
Expand file tree Collapse file tree 5 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -2,8 +2,11 @@ sudo: false
22language : python
33python :
44- ' 3.6'
5+ matrix :
6+ fast_finish : true
57env :
68 matrix :
9+ - TEST_FILENAME=''
710 - TEST_FILENAME=test_add_target.py::TestActiveFlag
811 - TEST_FILENAME=test_add_target.py::TestApplicationMetadata
912 - TEST_FILENAME=test_add_target.py::TestContentTypes
@@ -48,9 +51,8 @@ install:
4851- travis_retry npm install -g markdownlint-cli
4952cache : pip
5053before_script :
51- - make lint
5254- python ci/set_secrets_file.py
5355script :
54- - pytest --exitfirst -vvv tests/mock_vws/"$TEST_FILENAME" --cov=src --cov=tests
56+ - python ci/run_script.py
5557after_success :
5658- codecov
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ pip install --editable .[dev]
1414
1515Insall ` npm ` dependencies for linting Markdown files:
1616
17- ```
17+ ``` sh
1818npm install -g markdownlint-cli
1919```
2020
Original file line number Diff line number Diff line change 1+ """
2+ Run tests and linters on Travis CI.
3+ """
4+
5+ import os
6+ import subprocess
7+ import sys
8+ from pathlib import Path
9+
10+ import pytest
11+
12+
13+ def run_test (test_filename : str ) -> None :
14+ """
15+ Run pytest with a given filename.
16+ """
17+ path = Path ('tests' ) / 'mock_vws' / test_filename
18+ result = pytest .main (
19+ [
20+ '-vvv' ,
21+ '--exitfirst' ,
22+ str (path ),
23+ '--cov=src' ,
24+ '--cov=tests' ,
25+ ]
26+ )
27+ sys .exit (result )
28+
29+
30+ if __name__ == '__main__' :
31+ TEST_FILENAME = os .environ .get ('TEST_FILENAME' )
32+ if TEST_FILENAME :
33+ run_test (test_filename = TEST_FILENAME )
34+ else :
35+ subprocess .check_call (['make' , 'lint' ])
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ datetime
1111decodable
1212dev
1313dict
14+ filename
1415foo
1516github
1617greyscale
You can’t perform that action at this time.
0 commit comments