1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 02:32:33 +01:00

update .travis.yml

- restrict builds to master branch and release tags
- implement 'core' and 'results' test categories
This commit is contained in:
Mike Fährmann 2018-03-19 17:57:32 +01:00
parent 3905474805
commit 8ef790de12
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
3 changed files with 48 additions and 14 deletions

View File

@ -1,14 +1,23 @@
sudo: false
language: python
python:
- 3.3
- 3.4
- 3.5
- 3.6
install:
- pip install -r requirements.txt
script:
- if [[ $TRAVIS_PYTHON_VERSION != '3.6' ]]; then nosetests --ignore-files=test_extractors --verbose test; fi
- if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then nosetests --verbose test; fi
- "3.3"
- "3.4"
- "3.5"
- "3.6"
env:
- GALLERYDL_TESTS=core
matrix:
include:
- python: "3.6"
- env: GALLERYDL_TESTS=results
sudo: false
git:
depth: 10
depth: 3
branches:
only:
- master
- /^v\d+\.\d+\.\d+(-\S*)?$/
script:
- ./scripts/run_tests.sh

24
scripts/run_tests.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/bash
ROOTDIR="$(realpath "$(dirname "$0")/..")/"
TESTS_CORE=(config cookies oauth text util)
TESTS_RESULTS=(extractors)
# select tests
TESTS=()
case "${GALLERYDL_TESTS}" in
core) TESTS=( ${TESTS_CORE[@]} );;
results) TESTS=( ${TESTS_RESULTS[@]} );;
esac
# transform each array element to test_###.py
TESTS=( ${TESTS[@]/#/test_} )
TESTS=( ${TESTS[@]/%/.py} )
# run 'nosetests' with selected tests
# (or all tests if ${TESTS} is empty)
nosetests --verbose -w "${ROOTDIR}/test/" ${TESTS[@]}

View File

@ -21,11 +21,12 @@ TRAVIS_SKIP = {
# temporary issues, etc.
BROKEN = {
"mangapark",
"puremashiro", # online reader down
}
class TestExtractors(unittest.TestCase):
class TestExtractorResults(unittest.TestCase):
def setUp(self):
name = "gallerydl"
@ -159,7 +160,7 @@ def generate_tests():
)
]
# add 'test_...' methods to TestExtractors
# add 'test_...' methods
for extr in extractors:
if not hasattr(extr, "test") or not extr.test:
continue
@ -167,7 +168,7 @@ def generate_tests():
for num, tcase in enumerate(extr.test, 1):
test = _generate_test(extr, tcase)
test.__name__ = name + str(num)
setattr(TestExtractors, test.__name__, test)
setattr(TestExtractorResults, test.__name__, test)
generate_tests()