From 0e780e9741972e793a1461a78c36447a1efcf93b Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Fri, 8 Nov 2013 18:40:55 +0100 Subject: [PATCH] Fix random test case. --- tests/test_comics.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/test_comics.py b/tests/test_comics.py index 98c536c19..112b7e38c 100644 --- a/tests/test_comics.py +++ b/tests/test_comics.py @@ -10,7 +10,6 @@ try: from urllib.parse import urlsplit except ImportError: from urlparse import urlsplit -from itertools import islice from unittest import TestCase from dosagelib import scraper @@ -140,12 +139,17 @@ def make_comic_tester(name, **kwargs): def generate_comic_testers(): """For each comic scraper, create a test class.""" g = globals() - if "TESTALL" not in os.environ: - # Get limited number of scraper tests on Travis builds. - max_scrapers = 1 - scraperclasses = islice(scraper.get_scraperclasses(), 0, max_scrapers) - else: + if "TESTALL" in os.environ: + # test all comics (this will take some time) scraperclasses = scraper.get_scraperclasses() + else: + # Get limited number of scraper tests on Travis builds to make + # it faster + testscrapernames = ['GoComics/CalvinandHobbes'] + scraperclasses = [ + scraperclass for scraperclass in scraper.get_scraperclasses() + if scraperclass.getName() in testscrapernames + ] for scraperclass in scraperclasses: name = 'Test'+scraperclass.__name__ g[name] = make_comic_tester(name, scraperclass=scraperclass)