Skip to content

Commit e3a37cb

Browse files
committed
09_git.ipynb: Make it work in Python 3.6, and other fixes
The `capture_output` named parameter was added to `subprocess.run` in Python 3.7. For GitHub CI (which uses Python 3.6) to work its use had to be replaced by using `stdout=PIPE`. While at it, emphasize where tests are in Markdown cells, and fix outdated information about the repository used for tests.
1 parent 63ba2ed commit e3a37cb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

09_git.ipynb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,7 +3322,7 @@
33223322
"cell_type": "markdown",
33233323
"metadata": {},
33243324
"source": [
3325-
"Let's test `sparse_clone()`, for example using very small [`https://github.com/octocat/Spoon-Knife`](https://github.com/octocat/Spoon-Knife) repository created for the purpose of teaching forking in GitHub."
3325+
"Let's **test** **`sparse_clone()`**, for example using quite small and archived [`https://github.com/githubtraining/hellogitworld`](https://github.com/githubtraining/hellogitworld) \"Hello Git World\" sample training repository."
33263326
]
33273327
},
33283328
{
@@ -3361,8 +3361,10 @@
33613361
"\n",
33623362
"#!git -C repos/hellogitworld.git config --get remote.origin.url\n",
33633363
"#!git -C repos/hellogitworld.git remote show -n origin\n",
3364+
"\n",
3365+
"# NOTE: `capture_output` was added in Python 3.7, GitHub CI runs Python 3.6\n",
33643366
"assert subprocess.run(['git', '-C', repo_path, 'config', '--get', 'remote.origin.url'],\n",
3365-
" capture_output=True).stdout.decode(\"utf-8\").strip() == repo_url\n",
3367+
" stdout=subprocess.PIPE).stdout.decode(\"utf-8\").strip() == repo_url\n",
33663368
"print('ok - cloned repository has correct url')\n",
33673369
"\n",
33683370
"# attempt cleanup after the test, which may not work on MS Windows\n",
@@ -3522,7 +3524,7 @@
35223524
"cell_type": "markdown",
35233525
"metadata": {},
35243526
"source": [
3525-
"Let's test the easy-to-test internal function `_repo_name_to_out_path()`"
3527+
"Let's **test** the easy-to-test internal function **`_repo_name_to_out_path()`**."
35263528
]
35273529
},
35283530
{
@@ -3671,7 +3673,7 @@
36713673
"cell_type": "markdown",
36723674
"metadata": {},
36733675
"source": [
3674-
"Instead of testing all those functions one by one, let's simply test the final one, namely `commit_graph()`, which would would as an integration test. It would stress almost all other functions."
3676+
"Instead of testing all those functions one by one, let's simply **test the final one**, namely **`commit_graph()`**, which would would as an integration test. It would stress test almost all other functions."
36753677
]
36763678
},
36773679
{

0 commit comments

Comments
 (0)