File tree Expand file tree Collapse file tree 1 file changed +29
-4
lines changed
Expand file tree Collapse file tree 1 file changed +29
-4
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
You can’t perform that action at this time.
0 commit comments