Learning Django By Making A Tutorial - Part 3 - And a Red-Green Output for unittest
`youtube: https://www.youtube.com/watch?v=Al7PxVscCog`
### [Start: 00:00:00] - Testing Django
I spent most of the stream learning how to do testing inside of Django. Part of that includes jumping over to the Mozilla tutorial which looks worth investigating.
### [Time: 2:06:50] - Building a Red Green Color Module for Python's unittest
I'm constantly frustrated by the fact that Python's unittest output is always colored red. Even when all the tests pass. It means you have to look and find the "OK" which requires turning more of your attention to the text. It would be much better if the color of the results was red on failure and green when everything passes (you know, like the whole Red/Green terminology we use).
I build some code a while ago that lets me run test inside a script and only perform the main part of the script if the tests pass. I realized I could use that same code to switch the output of unittest to red/green depending on failure/success. By the end of the session, I got it working. Next step is to figure out how to put it into a module and post it to pip.
### Table Of Contents
- Part 1 - Getting the home page to work - Part 2 - Reviewing the first draft and building a model, view, and url structure for a checklist page - Part 3 - Learning how to test. And, making a python module so that unittest's output is green instead of red when tests pass. - Part 4 - Part 5 - Working with forms and getting a pointer to generic views. - Part 6 - Review run-through and adding URLs.
### Links From The Stream
- ANSI escape code - Wikipedia - Build your own Command Line with ANSI escape codes - Calling forward function without .forward() - Stack Overflow - can that work? - Stack Overflow - Classes — Python 3.9.0 documentation - Creating Modules in Python 3 - Curses Programming with Python — Python 3.9.0 documentation - Don't use plain forward in python · Issue #3 · IgorSusmelj/pytorch-styleguide - functools — Higher-order functions and operations on callable objects — Python 2.7.18 documentation - Get __name__ of calling function's module in Python - Stack Overflow - How to do unit testing of functions writing files using python unittest - Stack Overflow - How to import other Python files? - Stack Overflow - How to import other Python files? - How to print colored text in Python? - Stack Overflow - https://svn.blender.org/svnroot/bf-blender/trunk/blender/build_files/scons/tools/bcolors.py - importing a module when the module name is in a variable - Stack Overflow - inspect — Inspect live objects — Python 3.9.0 documentation - Modules — Python 3.9.0 documentation - Object Oriented Programming in Pyth: Class and Instance Variables - Pycharm won't allow to run a file. Shows run unittest option only. - Stack Overflow - redgreenunittests/redgreenunittest at master · stevematney/redgreenunittests - turtle — Turtle graphics — Python 3.9.0 documentation - unittest — Unit testing framework — Python 3.9.0 documentation - unittest-prettify · PyPI