Merge pull request #184 from PiRSquared17/fix-tests

Fix tox.ini and clean up/update tests, avoid a loop to make tests pass
pull/186/head
nemobis 10 years ago
commit f52051f8ae

@ -729,10 +729,15 @@ def getImageNamesScraper(config={}, session=None):
# print filename, url # print filename, url
if re.search(r_next, raw): if re.search(r_next, raw):
offset = re.findall(r_next, raw)[0] new_offset = re.findall(r_next, raw)[0]
# Avoid infinite loop
if new_offset != offset:
offset = new_offset
retries += 5 # add more retries if we got a page with offset retries += 5 # add more retries if we got a page with offset
else: else:
offset = '' offset = ''
else:
offset = ''
if (len(images) == 1): if (len(images) == 1):
print ' Found 1 image' print ' Found 1 image'

@ -46,6 +46,7 @@ class TestDumpgenerator(unittest.TestCase):
t1 = time.time() t1 = time.time()
delay(config=config) delay(config=config)
t2 = time.time() - t1 t2 = time.time() - t1
print 'Elapsed time in seconds (approx.):', t2
self.assertTrue(t2 > i and t2 < i + 1) self.assertTrue(t2 > i and t2 < i + 1)
def test_getImages(self): def test_getImages(self):
@ -59,7 +60,7 @@ class TestDumpgenerator(unittest.TestCase):
# Alone wikis # Alone wikis
#['http://wiki.annotation.jp/index.php', 'http://wiki.annotation.jp/api.php', u'かずさアノテーション - ソーシャル・ゲノム・アノテーション.jpg'], #['http://wiki.annotation.jp/index.php', 'http://wiki.annotation.jp/api.php', u'かずさアノテーション - ソーシャル・ゲノム・アノテーション.jpg'],
['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'Archive-is 2013-07-02 17-05-40.png'], ['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'Archive-is 2013-07-02 17-05-40.png'],
['http://skilledtests.com/wiki/index.php5', 'http://skilledtests.com/wiki/api.php', u'Benham\'s disc (animated).gif'], ['http://skilledtests.com/wiki/index.php', 'http://skilledtests.com/wiki/api.php', u'Benham\'s disc (animated).gif'],
# Editthis wikifarm # Editthis wikifarm
# It has a page view limit # It has a page view limit
@ -136,7 +137,7 @@ class TestDumpgenerator(unittest.TestCase):
tests = [ tests = [
# Alone wikis # Alone wikis
['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'April Fools\' Day'], ['http://archiveteam.org/index.php', 'http://archiveteam.org/api.php', u'April Fools\' Day'],
['http://skilledtests.com/wiki/index.php5', 'http://skilledtests.com/wiki/api.php', u'Conway\'s Game of Life'], ['http://skilledtests.com/wiki/index.php', 'http://skilledtests.com/wiki/api.php', u'Conway\'s Game of Life'],
# Gentoo wikifarm # Gentoo wikifarm
['http://wiki.gentoo.org/index.php', 'http://wiki.gentoo.org/api.php', u'/usr move'], ['http://wiki.gentoo.org/index.php', 'http://wiki.gentoo.org/api.php', u'/usr move'],
@ -182,7 +183,7 @@ class TestDumpgenerator(unittest.TestCase):
tests = [ tests = [
# Alone wikis # Alone wikis
['http://archiveteam.org', 'http://archiveteam.org/api.php', 'http://archiveteam.org/index.php'], ['http://archiveteam.org', 'http://archiveteam.org/api.php', 'http://archiveteam.org/index.php'],
['http://skilledtests.com/wiki/', 'http://skilledtests.com/wiki/api.php', 'http://skilledtests.com/wiki/index.php5'], ['http://skilledtests.com/wiki/', 'http://skilledtests.com/wiki/api.php', 'http://skilledtests.com/wiki/index.php'],
# Editthis wikifarm # Editthis wikifarm
# It has a page view limit # It has a page view limit

@ -9,4 +9,6 @@ envlist = py27
[testenv] [testenv]
# Test command with output reported # Test command with output reported
commands = nosetests --nocapture --nologcapture commands = nosetests --nocapture --nologcapture
deps = nose deps =
nose
-rrequirements.txt

Loading…
Cancel
Save