mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
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>
28 lines
811 B
Python
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)
|