comparison env/lib/python3.9/site-packages/bioblend/_tests/TestGalaxyInstance.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 """
2 Tests on the GalaxyInstance object itself.
3 """
4 import time
5
6 from bioblend import ConnectionError
7 from bioblend.galaxy import GalaxyInstance
8 from bioblend.galaxy.client import Client
9 from .test_util import unittest
10
11
12 class TestGalaxyInstance(unittest.TestCase):
13
14 def setUp(self):
15 # "connect" to a galaxy instance that doesn't exist
16 self.gi = GalaxyInstance("http://localhost:56789", key="whatever")
17
18 def test_set_max_get_retries(self):
19 self.gi.max_get_attempts = 3
20 self.assertEqual(3, Client.max_get_retries())
21
22 def test_set_retry_delay(self):
23 self.gi.get_retry_delay = 5
24 self.assertEqual(5, Client.get_retry_delay())
25
26 def test_get_retry(self):
27 # We set the client to try twice, with a delay of 5 seconds between
28 # attempts. So, we expect the call to take at least 5 seconds before
29 # failing.
30 self.gi.max_get_attempts = 2
31 self.gi.get_retry_delay = 5
32 start = time.time()
33 try:
34 self.gi.libraries.get_libraries()
35 self.fail("Call to show_libraries should have raised a ConnectionError")
36 except ConnectionError:
37 end = time.time()
38 duration = end - start
39 self.assertGreater(duration, self.gi.get_retry_delay, "Didn't seem to retry long enough")