Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/bioblend/_tests/TestGalaxyInstance.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
| author | shellac |
|---|---|
| date | Sat, 02 May 2020 07:14:21 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:26e78fe6e8c4 |
|---|---|
| 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") |
