2
0
mirror of https://github.com/WikiTeam/wikiteam synced 2024-11-16 21:27:46 +00:00

Merge pull request #184 from PiRSquared17/fix-tests

Fix tox.ini and clean up/update tests, avoid a loop to make tests pass
This commit is contained in:
nemobis 2014-09-20 17:54:16 +02:00
commit f52051f8ae
3 changed files with 29 additions and 21 deletions

View File

@ -729,8 +729,13 @@ 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]
retries += 5 # add more retries if we got a page with offset # Avoid infinite loop
if new_offset != offset:
offset = new_offset
retries += 5 # add more retries if we got a page with offset
else:
offset = ''
else: else:
offset = '' offset = ''

View File

@ -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

View File

@ -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