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

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
line wrap: on
line source

Tests on the GalaxyInstance object itself.
import time

from bioblend import ConnectionError
from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.client import Client
from .test_util import unittest

class TestGalaxyInstance(unittest.TestCase):

    def setUp(self):
        # "connect" to a galaxy instance that doesn't exist = GalaxyInstance("http://localhost:56789", key="whatever")

    def test_set_max_get_retries(self): = 3
        self.assertEqual(3, Client.max_get_retries())

    def test_set_retry_delay(self): = 5
        self.assertEqual(5, Client.get_retry_delay())

    def test_get_retry(self):
        # We set the client to try twice, with a delay of 5 seconds between
        # attempts. So, we expect the call to take at least 5 seconds before
        # failing. = 2 = 5
        start = time.time()
  "Call to show_libraries should have raised a ConnectionError")
        except ConnectionError:
            end = time.time()
        duration = end - start
        self.assertGreater(duration,, "Didn't seem to retry long enough")