Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

TDD Recap & Review

This is the last video of the course and provides you a summary of what you have learned during this course.

Resources

Dibsdalec on March 14, 2019

I enjoyed this, speech and diction was clear, succinct and relevant. Liked the flow of how tests lead the development of the object. fixtures and coverage were covered in a simple to understand manner. Well done.

Majid Bilal on March 15, 2019

This was useful and perhaps this could be my first step into test driven development.

Shay Elmualem on March 15, 2019

Thanks Chyld! great stuff.

Also, really like your vscode theme or at least the font - mind sharing what that is?

Thanks!

Chyld Medford on March 16, 2019

The theme is Monokai Pro. www.monokai.pro/vscode/

I use either Dank Mono or Operator Mono. dank.sh/ www.typography.com/fonts/operator/styles/

Shay Elmualem on March 16, 2019

Perfect, thanks again

Anonymous on April 28, 2019

Excellent

Abdullah on May 10, 2019

Great tutorials. It gives you the big picture of the unit testing concept by pytest in a short time. These tutorials will be the good choice if you don’t have enough time to study the pytest framework because it drives you to the important concepts that you need to start testing your code.

Thank you.

Corey Hermanson on May 18, 2019

Thank you Chyld! This was a fantastic bite-sized intro to TDD. Excited to implement.

senatoduro8 on July 27, 2019

This is the perfect tutorial. Now I feel comfortable about test driven development. Can you point me. @Chyld, can you point me to a great resource for learning the advance stuffs when it comes to test driven development with pytest?

ashokbayana369 on Aug. 14, 2019

Really Great tutorial, I learned the concepts of applying TDD practically :)

Najmeh on Aug. 21, 2019

Thank you very much for giving a clear explanation. Great job!

Lee RP Team on Oct. 29, 2019

This demystified pytest fixtures for me. Thank you!

Jacob Andersen on Nov. 14, 2019

The --cov flag didnt work for me until i manually installed cov with pip install pytest-cov. Otherwise, excellent tutorial with nice pace.

lmik16 on Dec. 24, 2019

How do you make testrun results colorful in the terminal? I use git-bash on windows…

Gareth on Jan. 8, 2020

That was a good tutorial, thank you.

Vinothkumar on Jan. 16, 2020

Very good introductory tutorial for developer getting into testing in Python especially pytest. Thank you.

mark92 on Jan. 22, 2020

The information presented is useful to me. My next task is to automate testing on my current project and this material will help me to move forward.

Lokman on Feb. 19, 2020

Thanks for this lesson video it’s helpful.

contactpunitjain on March 11, 2020

Nice description on fixtures. Hope to see some on mocks as well :)

amiralipourskandani on March 27, 2020

Thanks for the useful video. I did not quite get why the len attribute of the stack class is defined as __len__ and in the test_stack file why you called it directly rather than using stack.len()? Thanks

khoacoffee on April 7, 2020

I haven’t touched Python or pytest for a while, and this course refreshes my memory. The test coverage feature of pytest is new for me, and I was wondering how to get the coverage if the application under test is NOT written in python.

Priya katta on April 8, 2020

Thank you!…the course is very helpful.

saschakiefer on April 14, 2020

Great introduction, thanks a lot. For a Python Newbie, that is very helpful.

Vasanth T on April 26, 2020

Good one. Thanks!

MigukNamja on May 30, 2020

FYI - when I first tried to use –cov, I got the following error:

[miguknamja@mbp ~/python-tdd]$ python3 -m pytest -v --cov
ERROR: usage: __main__.py [options] [file_or_dir] [file_or_dir] [...]
__main__.py: error: unrecognized arguments: --cov
  inifile: None
  rootdir: /Users/miguknamja/python-tdd

To fix it, I simply had to install pytest-cov

$ pip install pytest-cov

Note : I’m using python3.

ttpython20 on July 20, 2020

Thank you, I would love more advanced course on this topic!

LSP on July 31, 2020

adding --cov just got too much info, apparently all the packages have been checked.

/usr/local/lib/python3.8/site-packages/_pytest/monkeypatch.py              168    155     8%
/usr/local/lib/python3.8/site-packages/_pytest/nodes.py                    320    251    22%
/usr/local/lib/python3.8/site-packages/_pytest/pastebin.py                  70     69     1%
/usr/local/lib/python3.8/site-packages/_pytest/pathlib.py                  301    268    11%
/usr/local/lib/python3.8/site-packages/_pytest/python.py                   822    764     7%
/usr/local/lib/python3.8/site-packages/_pytest/reports.py                  272    262     4%
/usr/local/lib/python3.8/site-packages/_pytest/resultlog.py                 73     71     3%
/usr/local/lib/python3.8/site-packages/_pytest/runner.py                   295    248    16%
/usr/local/lib/python3.8/site-packages/_pytest/setuponly.py                 56     54     4%
/usr/local/lib/python3.8/site-packages/_pytest/setupplan.py                 24     22     8%
/usr/local/lib/python3.8/site-packages/_pytest/skipping.py                 175    171     2%
/usr/local/lib/python3.8/site-packages/_pytest/stepwise.py                  70     59    16%
/usr/local/lib/python3.8/site-packages/_pytest/store.py                     34     29    15%
/usr/local/lib/python3.8/site-packages/_pytest/terminal.py                 855    702    18%
/usr/local/lib/python3.8/site-packages/_pytest/tmpdir.py                    91     84     8%
/usr/local/lib/python3.8/site-packages/_pytest/warnings.py                 101     83    18%
/usr/local/lib/python3.8/site-packages/attr/converters.py                   27     25     7%
/usr/local/lib/python3.8/site-packages/more_itertools/more.py              930    921     1%
/usr/local/lib/python3.8/site-packages/pluggy/_tracing.py                   41     31    24%
/usr/local/lib/python3.8/site-packages/pluggy/callers.py                   125     89    29%
/usr/local/lib/python3.8/site-packages/pluggy/hooks.py                     175    106    39%
/usr/local/lib/python3.8/site-packages/pluggy/manager.py                   196    154    21%
/usr/local/lib/python3.8/site-packages/py/_builtin.py                      112     78    30%
/usr/local/lib/python3.8/site-packages/py/_code/__init__.py                  0      0   100%
/usr/local/lib/python3.8/site-packages/py/_code/code.py                    531    408    23%
/usr/local/lib/python3.8/site-packages/py/_error.py                         52     47    10%
/usr/local/lib/python3.8/site-packages/py/_path/common.py                  277    186    33%
/usr/local/lib/python3.8/site-packages/py/_path/local.py                   694    608    12%
/usr/local/lib/python3.8/site-packages/py/_vendored_packages/apipkg.py     149    126    15%
/usr/local/lib/python3.8/site-packages/py/_xmlgen.py                       170    168     1%
/usr/local/lib/python3.8/site-packages/pytest/collect.py                    18     16    11%
/usr/local/lib/python3.8/site-packages/pytest_cov/compat.py                 29     24    17%
/usr/local/lib/python3.8/site-packages/pytest_cov/engine.py                239    219     8%
/usr/local/lib/python3.8/site-packages/pytest_cov/plugin.py                207    193     7%
--------------------------------------------------------------------------------------------
TOTAL                                                                    14553  12502    14%

andrewh on Sept. 18, 2020

Thanks for another great intro course. I want to incorporate testing into my development but have a question below regarding applicability:

When working with Pandas to handle and condition data, should I use PyTest to check for errors/bugs in the output data?

e.g. that there are no null values in the DataFrame, or that totals of columns match in the output DataFrame compared to the input etc

Would this be an inappropriate use of testing, and should instead be done within the program as normal code?

Thanks

Andy

Julie Stenning on Sept. 27, 2020

I started my first TDD Python project this week. I thought that I would struggle with working out what tests to write before the program functions, but when I got down to it, I found the concept fairly easy. I have taken away that more than one assert can be used in a test. Fixtures for resetting objects and the coverage feature are new to me. Thank you.

Ghani on Oct. 27, 2020

Great course. Thanks!

ronaldoafonso on April 25, 2021

I had some issues with the file/dir layout suggested. So I had do copy the “test_stack.py” one directory up in the directory tree in order to follow along with the tutorual. Something like:

(venv-3.8.5) rafonso@ronaldoafonso-pc:~/Python/data_structure$ tree
.
├── datastructure
   ├── __init__.py
   └── stack.py
└── test_stack.py

1 directory, 3 files

I’m using a virtual environment that I created this way:

python -m venv venv-3.8.5

Glenn Lehman on Sept. 29, 2021

Nice introduction to this subject.

artemudovyk on April 11, 2022

Yeah, very nice course. Loved instructor’s diction and voice. Thanks! :)

dylanrose on April 27, 2022

In the (conda) environment I created to work along with this tutorial, running “python -m pytest -v –cov” didn’t work – I had to also install pytest-cov as well. After I did so, this command ran as intended.

itayregev on May 16, 2022

Thank you

Mohamed Awnallah on June 17, 2022

The course is good and informative based on hands-on experience. I like it but It will be awesome if there is more videos regards coverage metrics (code coverage and test coverage) as well as their pros and cons.

Szabi Keresztes on Aug. 23, 2022

Great, calm video series. Thanks a lot!

I kinda wanted to see how to test that an exception was thrown by the system under test. If the author or anybody has good resources on the topic I would appreciate.

D Ben on Feb. 27, 2023

Thank you! Simple and effective explanation on using pytest.

WhirleyRascal on March 11, 2023

Before this course I didn’t know what a fixture was. Fixtures are really useful. Now I much prefer pytest to unittest.

Jimben on Jan. 11, 2024

I really enjoyed the shortness and concise the examples were nothing over the top crazy, or hard to understand. They got straight to the point, and this short introduction makes me excited to learn more about PyTest!

Become a Member to join the conversation.