Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit135da3f

Browse files
committed
Remove tests/. Clean up some things.
The old tests are no longer needed on this branch.
1 parent1a6e62d commit135da3f

28 files changed

+122
-3946
lines changed

‎HISTORY.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
History/Changelog
22
=================
33

4-
0.1: 2012-11-xx
4+
0.1: 2012-xx-xx
55
---------------
66

7+
- 100% unit test coverage
8+
9+
0.1b1: 2012-10-31
10+
-----------------
11+
12+
- unit tests implemented using mock instead of hitting the GitHub API (#37)
13+
- Notifications API coverage
14+
15+
0.1b0: 2012-10-06
16+
-----------------
17+
718
- Support for the complete GitHub API (accomplished)
819

920
- Now also includes the Statuses API
1021
- Also covers the auto_init parameters to the Repository creation
1122
methodology
1223
- Limited implementation of iterators in the place of list functions.
1324

14-
-92% coverage by unit tests
25+
-98% coverage by unit tests

‎Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
# Copyright 2012, Ian Cordasco
44

55
COVERAGE_INCLUDE := github3/*.py
6+
TEST_RUNNER := run_tests.py
67

78
clean:
89
git clean -Xdf
910

1011
travis:
11-
pythonmocktests.py
12+
python$(TEST_RUNNER)
1213

1314
tests: travis
1415

‎README.rst

Lines changed: 13 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ github3.py
66
:alt: Build Status
77
:target: http://travis-ci.org/sigmavirus24/github3.py
88

9-
Eventually this will be a python module to access the GitHub v3 API.
9+
github3.py is a comprehensive, actively developed and extraordinarily stable
10+
wrapper around the GitHub API (v3).
1011

11-
This is not stable yet and there is no backwards compatibility yet. There will
12-
likely be some changes which change behavior in the near future.
12+
See HISTORY.rst for any "breaking" changes.
1313

1414
Installation
1515
------------
@@ -21,9 +21,6 @@ Installation
2121
Dependencies
2222
------------
2323

24-
Every-day Use
25-
~~~~~~~~~~~~~
26-
2724
-requests_ by Kenneth Reitz
2825

2926
.. _requests:https://github.com/kennethreitz/requests
@@ -32,10 +29,12 @@ Testing
3229
~~~~~~~
3330

3431
-expecter_ by Gary Bernhardt
32+
-mock_ by Michael Foord
3533
- (optional)coverage_ by Ned Batchelder
3634

3735
.. _expecter:https://github.com/garybernhardt/expecter
3836
.. _coverage:http://nedbatchelder.com/code/coverage/
37+
.. _mock:http://mock.readthedocs.org/en/latest/
3938

4039
License
4140
-------
@@ -51,26 +50,7 @@ See the docs_ for more detailed examples.
5150

5251
.. _docs:http://github3py.readthedocs.org/en/latest/index.html#more-examples
5352

54-
::
55-
56-
>>> from github3 import login
57-
>>> gh = login(username, password)
58-
>>> issue = gh.issue('sigmavirus24', 'Todo.txt-python', 17)
59-
>>> issue.html_url
60-
u'https://github.com/sigmavirus24/Todo.txt-python/issues/17'
61-
>>> issue.state
62-
u'open'
63-
>>> events = issue.list_events()
64-
>>> events
65-
[<Issue Event [#17 - subscribed - sigmavirus24]>, <Issue Event [#17 - assigned - sigmavirus24]>,
66-
<Issue Event [#17 - referenced - sigmavirus24]>]
67-
>>> events[0].actor
68-
<User [sigmavirus24:None]>
69-
>>> events[0].issue
70-
<Issue [sigmavirus24/Todo.txt-python #17]>
71-
>>> events[0].closed_at
72-
>>> events[0].event
73-
u'subscribed'
53+
Create a git blob:
7454

7555
::
7656

@@ -88,6 +68,8 @@ See the docs_ for more detailed examples.
8868
>>> blob.encoding
8969
u'base64'
9070

71+
Create a tag on a commit:
72+
9173
::
9274

9375
>>> from github3 import login
@@ -101,36 +83,14 @@ See the docs_ for more detailed examples.
10183
>>> tag.object.type
10284
u'commit'
10385

104-
Contributing
105-
------------
106-
107-
Please see thesection_ of the documentation pertaining to this.
108-
10986
Testing
11087
~~~~~~~
11188

112-
If you want to run the unittests with authentication, simply run::
113-
114-
make alltests
115-
116-
From the root of the repository. If you would rather see what will take place
117-
on Travis, run::
89+
::
11890

119-
make travis
120-
# or
12191
make tests
12292

123-
To test how much of the library is covered::
124-
125-
make coverage_auth
126-
# equivalently
127-
make coverage_all
128-
# or without authentication
129-
make coverage
130-
131-
Depending on which you run, you will see different percentages reported by
132-
coverage. As of this writing (2012-10-05), ``coverage_auth`` reports 98% of
133-
the library is covered and every module has coverage >= 93%.
93+
These coverage numbers are from the old-style tests and still apply to master.
13494

13595
::
13696

@@ -154,13 +114,6 @@ the library is covered and every module has coverage >= 93%.
154114
----------------------------------------
155115
TOTAL 2551 29 99%
156116

157-
That one miss from ``github3/api`` is bizarre since I know for a fact that
158-
there's a test for it in ``tests/test_api``. I wouldn't know how to reproduce
159-
it, so I won't report it to nedbat.
160-
161-
.. links
162-
.. _section:http://github3py.readthedocs.org/en/latest/index.html#contributing
163-
164117
Author
165118
------
166119

@@ -169,5 +122,6 @@ Ian Cordasco (sigmavirus24)
169122
Contact Options
170123
---------------
171124

172-
- You may contact (via email) the author directly with questions/suggestions
173-
- You may send your email to github3.py@librelist.com
125+
- It is preferred that you send an email to github3.py@librelist.com
126+
- You may also contact (via email) the author directly with
127+
questions/suggestions/comments

‎TODO.rst

Lines changed: 1 addition & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,7 @@ High priority
99
unittests
1010
~~~~~~~~~
1111

12-
- We're currently at ~92% coverage. I want to get each module close to if not
13-
above 90% coverage before December. 100% by next year (at the latest).
14-
15-
+ The major hurtle now are github3.github and github3.repos. Both contain
16-
functions/functionality that will be very difficult to design test cases
17-
for, e.g., creating a pull request, creating a pull request from an
18-
existing issue, creating a commit object, etc.
19-
20-
.. links
21-
22-
iterability
23-
~~~~~~~~~~~
24-
25-
- Replace all of the ``list_(.*)`` methods with ``iter_\1`` functions.
12+
Rewrite all unittests with mock.
2613

2714
github3.api
2815
~~~~~~~~~~~
@@ -39,70 +26,3 @@ logging
3926

4027
I need to determine if there is a desire for logging and where it would be
4128
most useful. I would probably take a cue from urllib3 in this instance.
42-
43-
Plan
44-
====
45-
46-
- Finish unittests
47-
- Design basic generator functionality to replace the ``list_*`` functions.
48-
49-
::
50-
51-
def iter_issues(self, milestone=None, state=None, assignee=None,
52-
mentioned=None, labels=None, sort=None, direction=None,
53-
since=None, count=-1):
54-
"""Iterates over issues on this repo based upon parameters passed.
55-
56-
:param milestone: (optional), 'none', or '*'
57-
:type milestone: int
58-
:param state: (optional), accepted values: ('open', 'closed')
59-
:type state: str
60-
:param assignee: (optional), 'none', '*', or login name
61-
:type assignee: str
62-
:param mentioned: (optional), user's login name
63-
:type mentioned: str
64-
:param labels: (optional), comma-separated list of labels, e.g.
65-
'bug,ui,@high' :param sort: accepted values:
66-
('created', 'updated', 'comments', 'created')
67-
:type labels: str
68-
:param direction: (optional), accepted values: ('open', 'closed')
69-
:type direction: str
70-
:param since: (optional), ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ
71-
:type since: str
72-
:param int count: (optional), numer of issues to iterate over, -1
73-
iterates over all issues
74-
"""
75-
def issues_left():
76-
return count == -1 or count > 0
77-
78-
url = self._build_url('issues', base_url=self._api)
79-
80-
params = {}
81-
if milestone in ('*', 'none') or isinstance(milestone, int):
82-
params['milestone'] = str(milestone).lower()
83-
84-
if assignee:
85-
params['assignee'] = assignee
86-
87-
if mentioned:
88-
params['mentioned'] = mentioned
89-
90-
params.update(issue_params(None, state, labels, sort, direction,
91-
since))
92-
93-
count = int(count)
94-
95-
while issues_left() and url:
96-
response = self._get(url)
97-
json = self._json(response, 200)
98-
for i in json:
99-
yield Issue(i, self)
100-
count -= 1
101-
if count == 0:
102-
break
103-
104-
rel_next = response.links.get('rel_next', {})
105-
url = rel_next.get('url', '')
106-
107-
Naturally, ``issues_left()`` will not be nested into each iterator, but for
108-
the purposes of this example, it is easier to define it there.

‎mock_tests/__init__.py

Whitespace-only changes.

‎mock_tests/test_github.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp