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

Commit22d2536

Browse files
committed
Add coverage measuring to run_tests.
Also allow GitHub to take tokens and add a documentation note. I don't knowwhy it wasn't there in the first place.
1 parent72a05eb commit22d2536

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

‎.coveragerc

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

‎github3/github.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,37 @@
2121

2222

2323
classGitHub(GitHubCore):
24-
"""Stores all the session information."""
25-
def__init__(self,login='',password=''):
24+
"""Stores all the session information.
25+
26+
Logging In
27+
----------
28+
29+
There are two ways to log into the GitHub API
30+
31+
::
32+
33+
from github3 import login
34+
g = login(user, password)
35+
g = login(token=token)
36+
g = login(user, token=token)
37+
38+
or
39+
40+
::
41+
42+
from github3 import GitHub
43+
g = GitHub(user, password)
44+
g = GitHub(token=token)
45+
g = GitHub(user, token=token)
46+
47+
This is simple backward compatibility since originally there was no way to
48+
call the GitHub object with authentication parameters.
49+
"""
50+
def__init__(self,login='',password='',token=''):
2651
super(GitHub,self).__init__({})
27-
ifloginandpassword:
52+
iftoken:
53+
self.login(login,token=token)
54+
elifloginandpassword:
2855
self.login(login,password)
2956

3057
def__repr__(self):

‎run_tests.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
importunittest
44
importos
55
importre
6+
importcoverage
7+
68

79
TEST_DIR='tests'
810

911
if__name__=="__main__":
12+
cov=coverage.coverage(source=['github3','tests'])
13+
cov.start()
14+
1015
# list files in directory tests/
1116
names=os.listdir(TEST_DIR)
1217
regex=re.compile("(?!_+)\w+\.py$")
@@ -15,3 +20,6 @@
1520
names= [join([TEST_DIR,f[:-3]])forfinnamesifregex.match(f)]
1621
suite=unittest.defaultTestLoader.loadTestsFromNames(names)
1722
unittest.TextTestRunner(verbosity=1).run(suite)
23+
24+
cov.stop()
25+
cov.save()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp