diff --git a/agithub/agithub_test.py b/agithub/agithub_test.py index ad79144..80d5ca9 100755 --- a/agithub/agithub_test.py +++ b/agithub/agithub_test.py @@ -57,8 +57,8 @@ def newIncompleteRequest(self): def test_pathByGetAttr(self): rb = self.newIncompleteRequest() - rb.hug.an.octocat - self.assertEqual(rb.url, "/hug/an/octocat") + test = rb.hug.an.octocat + self.assertEqual(test.url, "/hug/an/octocat") def test_callMethodDemo(self): rb = self.newIncompleteRequest() @@ -73,8 +73,8 @@ def test_callMethodDemo(self): def test_pathByGetItem(self): rb = self.newIncompleteRequest() - rb["hug"][1]["octocat"] - self.assertEqual(rb.url, "/hug/1/octocat") + test = rb["hug"][1]["octocat"] + self.assertEqual(test.url, "/hug/1/octocat") def test_callMethodTest(self): rb = self.newIncompleteRequest() diff --git a/agithub/base.py b/agithub/base.py index 88b8a31..2c54a88 100644 --- a/agithub/base.py +++ b/agithub/base.py @@ -79,9 +79,9 @@ class IncompleteRequest(object): To understand the method(...) calls, check out github.client.Client. """ - def __init__(self, client): + def __init__(self, client, url=""): self.client = client - self.url = '' + self.url = url def __getattr__(self, key): if key in self.client.http_methods: @@ -89,8 +89,8 @@ def __getattr__(self, key): wrapper = partial(htmlMethod, url=self.url) return update_wrapper(wrapper, htmlMethod) else: - self.url += '/' + str(key) - return self + new_url = self.url + '/' + str(key) + return IncompleteRequest(self.client, new_url) __getitem__ = __getattr__ diff --git a/setup.py b/setup.py index c9b753f..fd3fbc5 100755 --- a/setup.py +++ b/setup.py @@ -7,11 +7,19 @@ version = '2.2.2' +test_requirements = ['pytest'] + +extras = { + "test": test_requirements, +} + setup(name='agithub', version=version, description="A lightweight, transparent syntax for REST clients", long_description=long_description, long_description_content_type='text/markdown', + tests_require=test_requirements, + extras_require=extras, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console',