mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 03:41:08 +00:00
Add support to create Repository objects lazily in MainClass.
This lets users do the following without issuing an unnecessary request:
issues_of_my_repository = g.get_repo('PyGithub/PyGithub').get_issues()
Since the GithubObject layer handles laziness transparently, lazy
loading is enabled by default, and can be disabled via the `lazy`
kwarg. This does not affect any test except tests that pertain to
caching or laziness itself.
This commit is contained in:
@@ -31,14 +31,14 @@ import github
|
||||
class ConditionalRequestUpdate(Framework.TestCase):
|
||||
def setUp(self):
|
||||
Framework.TestCase.setUp(self)
|
||||
self.repo = self.g.get_repo("akfish/PyGithub")
|
||||
self.repo = self.g.get_repo("akfish/PyGithub", lazy=False)
|
||||
|
||||
def testDidNotUpdate(self):
|
||||
self.assertFalse(self.repo.update(), msg="The repo is not changes. But update() != False")
|
||||
self.assertFalse(self.repo.update(), msg="The repo is not changed. But update() != False")
|
||||
|
||||
def testDidUpdate(self):
|
||||
self.assertTrue(self.repo.update(), msg="The repo should be changed by now. But update() != True")
|
||||
|
||||
def testUpdateObjectWithoutEtag(self):
|
||||
r = self.g.get_repo("jacquev6/PyGithub")
|
||||
r = self.g.get_repo("jacquev6/PyGithub", lazy=False)
|
||||
self.assertTrue(r.update())
|
||||
|
||||
Reference in New Issue
Block a user