Allow selection of comics to test via environment.
If you need to run test cases for your new comic module, you can call py.test like this: TESTCOMICS="ComicFury/" py.test -v tests/test_comics.py
This commit is contained in:
parent
2ca74d6e6b
commit
36cc4e32f4
1 changed files with 13 additions and 8 deletions
|
@ -128,16 +128,21 @@ def get_test_scraperclasses():
|
||||||
# test all comics (this will take some time)
|
# test all comics (this will take some time)
|
||||||
scraperclasses = scraper.get_scraperclasses()
|
scraperclasses = scraper.get_scraperclasses()
|
||||||
else:
|
else:
|
||||||
# Get limited number of scraper tests on Travis builds to make
|
if 'TESTCOMICS' in os.environ:
|
||||||
# it faster
|
scraper_pattern = re.compile(os.environ['TESTCOMICS'])
|
||||||
testscrapernames = [
|
else:
|
||||||
'AbstruseGoose',
|
# Get limited number of scraper tests on Travis builds to make it
|
||||||
'GoComics/CalvinandHobbes',
|
# faster
|
||||||
'xkcd'
|
testscrapernames = [
|
||||||
]
|
'AbstruseGoose',
|
||||||
|
'GoComics/CalvinandHobbes',
|
||||||
|
'xkcd'
|
||||||
|
]
|
||||||
|
scraper_pattern = re.compile('|'.join(testscrapernames))
|
||||||
|
|
||||||
scraperclasses = [
|
scraperclasses = [
|
||||||
scraperclass for scraperclass in scraper.get_scraperclasses()
|
scraperclass for scraperclass in scraper.get_scraperclasses()
|
||||||
if scraperclass.getName() in testscrapernames
|
if scraper_pattern.match(scraperclass.getName())
|
||||||
]
|
]
|
||||||
return scraperclasses
|
return scraperclasses
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue