File tree Expand file tree Collapse file tree 2 files changed +30
-5
lines changed
Expand file tree Collapse file tree 2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change @@ -296,14 +296,39 @@ always include both `push` and `pull_request` in your testing workflows.
296296Can you engineer a situation where a CI job passes on `push` but
297297fails on `pull_request`?
298298
299- - Write a new function, commit the changes, and push it to your `main`
300- branch.
299+ - Write a function to a new file, commit the changes, and push it to your `main`
300+ branch. It can be something as simple as :
301+
302+ ` ` ` python
303+ # file: message.py
304+
305+ def message():
306+ return "foo"
307+ ` ` ` `
308+
301309- Switch to a new branch ` my_branch` with `git switch -c my_branch`,
302- and write a test for that function.
310+ and write a test for that function in a new file :
311+
312+ ` ` ` python
313+ # file: test_message.py
314+ from message import message
315+
316+ def test_message():
317+ assert message() == "foo"
318+ ` ` `
319+
303320- Check that the test passes, and commit it.
304321- Push `my_branch` to GitHub with `git push -u origin my_branch`,
305322 but don't raise a pull request yet.
306- - Return to your `main` branch, and modify the function being tested.
323+ - Return to your `main` branch, and modify the function being tested :
324+
325+ ` ` ` python
326+ # file: message.py
327+
328+ def message():
329+ return "bar"
330+ ` ` `
331+
307332- Push the changes to `main`.
308333- Now raise a pull request from `my_branch` into `main`.
309334
Original file line number Diff line number Diff line change 1414"episodes/07-fixtures.Rmd" "3b74462f3bfc250338ca8e1f64675ad0" "site/built/07-fixtures.md" "2026-02-17"
1515"episodes/08-parametrization.Rmd" "7731b88a93e54e205a45dd3ceeae9df2" "site/built/08-parametrization.md" "2026-02-17"
1616"episodes/09-testing-output-files.Rmd" "3ec8b815934521f0a4d244bcb585a8d6" "site/built/09-testing-output-files.md" "2026-02-17"
17- "episodes/10-CI.Rmd" "293ff61e46e7172894ff4955b0cc5d8a " "site/built/10-CI.md" "2026-02-17"
17+ "episodes/10-CI.Rmd" "eb537ca2be5006b0fa4d6d2ce821574f " "site/built/10-CI.md" "2026-02-17"
1818"instructors/instructor-notes.md" "cae72b6712578d74a49fea7513099f8c" "site/built/instructor-notes.md" "2026-02-17"
1919"learners/reference.md" "1e67e9d33803966d818d4be17ae556f9" "site/built/reference.md" "2026-02-17"
2020"learners/setup.md" "8dd30b446b675c08ef97d21c8a807c68" "site/built/setup.md" "2026-02-17"
You can’t perform that action at this time.
0 commit comments