book-tdd-web-dev-python
Book - TDD web dev with Python
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.0%) to scientific vocabulary
Repository
Book - TDD web dev with Python
Basic Info
- Host: GitHub
- Owner: hjwp
- License: other
- Language: Python
- Default Branch: main
- Homepage: https://www.obeythetestinggoat.com
- Size: 107 MB
Statistics
- Stars: 498
- Watchers: 36
- Forks: 174
- Open Issues: 18
- Releases: 0
Metadata Files
README.md
Test-Driven Web Development With Python, the book.
License
The sources for this book are published under the Creative Commons Attribution Non-Commercial No-Derivs license (CC-BY-NC-ND).
I wouldn't recommend using this version to read the book. Head over to obeythetestinggoat.com when you can access a nicely formatted version of the full thing, still free and under CC license. And you'll also be able to buy an ebook or print version if you feel like it.
These sources are being made available for the purposes of curiosity (although if you're curious about the way the listings are tested, i would definitely recommend https://github.com/cosmicpython/book instead) and collaboration (typo-fixes by pull request are very much encouraged!).
Building the book as HTML
- install asciidoctor, and the pygments/pygmentize gem.
make buildwill build each chapter as its own html filemake book.htmlwill create a single filemake chapter_05_post_and_database.html, eg, will build chapter 5
Running the tests
- Pre-requisites for the test suite:
console
make install
- Full test suite (probably, don't use this, it would take ages.)
console
$ make test
- To test an individual chapter, eg:
console
$ make test_chapter_06_explicit_waits_1
If you see a problem that seems to be related to submodules, try:
console
make update-submodules
- Unit tests (tests for the tests for the tests in the testing book)
console
$ ./run_test_tests.sh
Windows / WSL notes
vagrant plugin install virtualbox_WSL2is required
Making changes to the book's code examples
Brief explanation: each chapter's code examples are reflected in a branch of the example code repository, https://github.com/hjwp/book-example in branches named after the chapter, so eg chapter02unittest.asciidoc has a branch called chapter02unittest.
These branches are actually checked out, one by one, as submodules in source/
Code listings mostly map 1 to 1 with commits in the repo, and they are sometimes marked with little tags, eg ch03l007, meaning theoretically, the 7th listing in chapter 3, but that's not always accurate.
When the tests run, they start by creating a new folder in /tmp checked out with the code from the end of the last chapter.
Then they go through the code listings in the book one by one, and simulate typing them into to an editor. If the code listing has one of those little tags, the tests check the commit in the repo to see if the listing matches the commit exactly. (if there's no tag, there's some fiddly code based on string manipulation that tries to figure out how to insert the code listing into the existing file contents at the right place)
When the tests come across a command, eg "ls", they actually run "ls" in the temp directory, to check whether the output that's printed in the book matches what would actually happen.
One of the most common commands is to run the tests, obviously, so much so that if there is some console output in the book with no explicit command, the tests assume it's a test run, so they run "./manage.py test" or equivalent.
In any case, back to our code listings - the point is that, if we want to change one of our code listings, we also need to change the commit in the branch / submodule...
...and all of the commits that come after it.
...for that chapter and every subsequent chapter.
This is called "feeding through the changes"
Changing a code listing
- change the listing in the book, eg in in chapter03unittestfirstview.asciidoc_
- open up ./source/chapter03unittestfirst_view/superlists in a terminal
- do a
git rebase --interactive $previous-chapter-name - identify the commit that matches the listing that you've changed, and mark it for
edit - edit the file when prompted, make it match the book
- continue the rebase, and deal with an merge conflicts as you go, woo.
git push localonce you're happy.
feeding thru the changes
Because we don't want to push WIP to github every time we change a chapter, we use a local bare repository to push and pull chapters
console
make ../book-example.git
will create it for you.
TODO: helper to do git remote add local to each chapter/submodule
Now you can attempt to feed thru the latest changes to this branch/chapter with
```console cd source ./feedthru.sh chapter03unittestfirstview chapter04philosophyandrefactoring
chapter/branch names will tab complete, helpfully.
```
if all goes well, you can then run
console
./push-back.sh chapter_04_philosophy_and_refactoring
and move on to the next chapter. woo!
This may all seem a bit OTT, but the point is that if we change a variable early on in the book, git (along with the tests) will help us to make sure that it changes all the way through all the subsequent chapters.
Owner
- Name: Harry Percival
- Login: hjwp
- Kind: user
- Website: http://www.obeythetestinggoat.com
- Repositories: 133
- Profile: https://github.com/hjwp
GitHub Events
Total
- Issues event: 9
- Watch event: 9
- Delete event: 2
- Issue comment event: 23
- Push event: 272
- Pull request event: 91
- Pull request review event: 35
- Pull request review comment event: 36
- Fork event: 4
- Create event: 14
Last Year
- Issues event: 9
- Watch event: 9
- Delete event: 2
- Issue comment event: 23
- Push event: 272
- Pull request event: 91
- Pull request review event: 35
- Pull request review comment event: 36
- Fork event: 4
- Create event: 14
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| Harry | h****2@c****t | 3,617 |
| kristen@oreilly.com | k****n@o****m | 502 |
| kebrahim@oreilly.com | k****m@o****m | 496 |
| judymcconville@roadrunner.com | j****e@r****m | 490 |
| wendy@lastlookeditorial.com | w****y@l****m | 329 |
| Csanad Beres | q****s@g****m | 193 |
| Matthew Hacker | m****r@o****m | 146 |
| cfaucher | c****r@o****m | 69 |
| ritaf-ORM | 8****M | 34 |
| Sebastian Buczyński | n****a@g****m | 26 |
| David Seddon | d****n@o****m | 26 |
| Jan Giacomelli | j****i@g****m | 23 |
| Jonathan Hartley | t****y@t****m | 21 |
| Sarah Schneider | s****s@o****m | 18 |
| zipperer | z****w@g****m | 17 |
| Sam Lynch | s****h@o****m | 14 |
| James Evans | j****s | 12 |
| dfauxsmith@touchstone.east.ora.com | d****h@o****m | 9 |
| Meghanorm | m****n@o****m | 8 |
| sarknohun | s****r@o****m | 6 |
| Sanders Kleinfeld | s****s@o****m | 5 |
| bhagerty | b****y@y****m | 4 |
| Salmanul Farzy | s****y@g****m | 4 |
| Andrew-Zipperer | a****r@g****m | 4 |
| Andrea Crotti | a****0@g****m | 4 |
| harry.percival@gmail.com | h****l@g****m | 4 |
| Kristen Brown | k****n@t****m | 4 |
| Steve Nicholson | s****e@m****m | 3 |
| Chris Pappas | c****s@o****m | 3 |
| Eric Henziger | h****r@g****m | 2 |
| and 30 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 32
- Total pull requests: 169
- Average time to close issues: 10 months
- Average time to close pull requests: about 1 month
- Total issue authors: 23
- Total pull request authors: 40
- Average comments per issue: 2.13
- Average comments per pull request: 0.67
- Merged pull requests: 135
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 94
- Average time to close issues: 3 days
- Average time to close pull requests: 28 days
- Issue authors: 3
- Pull request authors: 8
- Average comments per issue: 0.67
- Average comments per pull request: 0.26
- Merged pull requests: 84
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- AndreaCrotti (8)
- mshob23 (4)
- FlowFX (3)
- artGonza (2)
- shun-liang (1)
- MarckK (1)
- zecafig (1)
- ScottMcCormack (1)
- moritz-weber (1)
- LeBodro (1)
- arnieelkins (1)
- sudoursa (1)
- paatre (1)
- stefanos82 (1)
- RivenSkaye (1)
Pull Request Authors
- hjwp (50)
- Xronophobe (42)
- seddonym (29)
- tartley (24)
- Enforcer (24)
- ritaf-ORM (19)
- jangia (16)
- jwm-evans (12)
- sarknohun (8)
- zipperer (4)
- AndreaCrotti (4)
- SSteve (3)
- mshob23 (3)
- salmanulfarzy (3)
- henziger (2)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v1 composite
- actions/setup-python v1 composite
- black *
- cssselect *
- django *
- django-types *
- docopt *
- lxml *
- lxml-stubs *
- pygments *
- pytest *
- requests *
- ruff *
- selenium <5
- whitenoise *