unittests: Preserve query timestamps between tests
This avoids getting rate limited while running all the tests.
This commit is contained in:
parent
a807408d8f
commit
0e433294ad
@ -16,6 +16,9 @@ NORMAL_MAX_COUNT = 2
|
|||||||
PAGING_MAX_COUNT = 15
|
PAGING_MAX_COUNT = 15
|
||||||
PRIVATE_PROFILE = "aandergr"
|
PRIVATE_PROFILE = "aandergr"
|
||||||
|
|
||||||
|
# Preserve query timestamps (rate control) between tests to not get rate limited
|
||||||
|
instaloadercontext_query_timestamps = list()
|
||||||
|
|
||||||
|
|
||||||
class TestInstaloaderAnonymously(unittest.TestCase):
|
class TestInstaloaderAnonymously(unittest.TestCase):
|
||||||
|
|
||||||
@ -27,8 +30,11 @@ class TestInstaloaderAnonymously(unittest.TestCase):
|
|||||||
download_comments=True,
|
download_comments=True,
|
||||||
save_metadata=True)
|
save_metadata=True)
|
||||||
self.L.context.raise_all_errors = True
|
self.L.context.raise_all_errors = True
|
||||||
|
self.L.context.query_timestamps = instaloadercontext_query_timestamps
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
global instaloadercontext_query_timestamps
|
||||||
|
instaloadercontext_query_timestamps = self.L.context.query_timestamps
|
||||||
self.L.close()
|
self.L.close()
|
||||||
os.chdir('/')
|
os.chdir('/')
|
||||||
print("Removing {}".format(self.dir))
|
print("Removing {}".format(self.dir))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user