8000 Merge pull request #394 from rgbkrk/nb_tests · krishvarag/github3.py@270f6d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 270f6d9

Browse files
committed
Merge pull request sigmavirus24#394 from rgbkrk/nb_tests
Initial go at running tests on example notebooks.
2 parents a58fbef + a3e678b commit 270f6d9

File tree

5 files changed

+27
-4
lines changed

5 files changed

+27
-4
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ env:
2828
- TOX_ENV=py27-flake8
2929
- TOX_ENV=py34-flake8
3030
- TOX_ENV=docstrings
31+
- TOX_ENV=notebooks
3132

3233
matrix:
3334
fast_finish: true

example-notebooks/iterating_over_public_gists.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"cell_type": "markdown",
101101
"metadata": {},
102102
"source": [
103-
"If you omit the number argument, github3.py will attempt to iterate over all public gists on GitHub. Unfortunately with a ratelimit of 60 unauthenticated requests per hour you will not be able to list them quickly. "To increase your ratelimit you would have to do the following (or something similar)."
103+
"If you omit the number argument, github3.py will attempt to iterate over all public gists on GitHub. Unfortunately with a ratelimit of 60 unauthenticated requests per hour you will not be able to list them quickly. To increase your ratelimit you would have to do the following (or something similar)."
104104
]
105105
},
106106
{

example-notebooks/two_factor_authentication.ipynb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,11 @@
100100
"cell_type": "markdown",
101101
"metadata": {},
102102
"source": [
103-
"The call to `authorize` will create an `Authorization` object which has a token. With the
104-
object you can pass the token to `login` and not have to worry about having to supply tokens generated by a mobile application or sent to your phone."
103+
"The call to `authorize` will create an `Authorization` object which has a token. With the object you can pass the token to `login` and not have to worry about having to supply tokens generated by a mobile application or sent to your phone."
105104
]
106105
}
107106
],
108107
"metadata": {}
109108
}
110109
]
111-
}
110+
}

tests/nbtest.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
3+
4+
import glob
5+
6+
from IPython.config import Config
7+
from IPython.nbconvert import HTMLExporter
8+
9+
c = Config({
10+
'ExecutePreprocessor': {'enabled': True}
11+
})
12+
13+
exporter = HTMLExporter(config=c)
14+
15+
for filename in glob.glob("example-notebooks/*.ipynb"):
16+
print(filename)
17+
exporter.from_filename(filename)

tox.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ deps =
2020
flake8
2121
commands = flake8 {posargs} github3/
2222

23+
[testenv:notebooks]
24+
basepython = python3.4
25+
deps =
26+
ipython[notebook]
27+
commands = python tests/nbtest.py
28+
2329
[testenv:docstrings]
2430
deps =
2531
flake8

0 commit comments

Comments
 (0)
0