Files
PyGithub/tests/PoolSize.py
T
Amador Pahim a77d4f48cb Enabling connetion pool_size definition
requests has a default connections pool of 10. Creating multiple threads
will consume from that same pool, since the underlying implementation of
the requests pool is a singletown.

Let's make the pool_size configurable, so clients can set the proper
number for their use case when running multiple threads.

Signed-off-by: Amador Pahim <apahim@redhat.com>
2021-01-08 11:55:36 +00:00

28 lines
811 B
Python

import github
from . import Framework
REPO_NAME = "PyGithub/PyGithub"
class PoolSize(Framework.TestCase):
def setUp(self):
Framework.setPoolSize(20)
super().setUp()
def testReturnsRepoAfterSettingPoolSize(self):
repository = self.g.get_repo(REPO_NAME)
self.assertIsInstance(repository, github.Repository.Repository)
self.assertEqual(repository.full_name, REPO_NAME)
def testReturnsRepoAfterSettingPoolSizeHttp(self):
g = github.Github(
self.login,
self.password,
base_url="http://my.enterprise.com",
pool_size=20,
)
repository = g.get_repo(REPO_NAME)
self.assertIsInstance(repository, github.Repository.Repository)
self.assertEqual(repository.full_name, REPO_NAME)