Meliowant

Meliowant

Python Testing with pytest, Second Edition: example with complex -k argument contains tests not mentioned previously (page 28)

There is the following example, on the page 28:

$ pytest -v --tb=no -k “(dict or ids) and not TestEquality”
=========================== test session starts ===========================
collected 24 items / 18 deselected / 6 selected
test_card.py::test_equality_with_diff_ids PASSED [ 16%]
test_card.py::test_from_dict PASSED [ 33%]
test_card.py::test_to_dict PASSED [ 50%]
test_classes.py::test_from_dict PASSED [ 66%]
test_classes.py::test_to_dict PASSED [ 83%]
test_structure.py::test_to_dict PASSED [100%]
==================== 6 passed, 18 deselected in 0.08s ====================

But tests test_from_dict() and test_to_dict() are missing (or at least were not mentioned) in the test_classes.py before that page. And this confuses.

I see that tests are in the source code that accompanies the book, so maybe these tests will be added to the test_classes.py later, but at the page 28 they don’t exist in the file.

Thus the example should be something like:

$ pytest -v --tb=no -k “(ids or dict) and not TestEqual”
============================ test session starts =============================
collected 19 items / 15 deselected / 4 selected
test_card.py::test_equality_with_diff_ids PASSED [ 25%]
test_card.py::test_from_dict PASSED [ 50%]
test_card.py::test_to_dict PASSED [ 75%]
test_structure.py::test_to_dict PASSED [100%]
====================== 4 passed, 15 deselected in 0.18s ======================

First Post!

brianokken

brianokken

Author of Python Testing with pytest

Sorry about the confusion.

Popular Pragmatic Bookshelf topics Top

New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
New
rmurray10127
Title: Intuitive Python: docker run… denied error (page 2) Attempted to run the docker command in both CLI and Powershell PS C:\Users\r...
New
brunogirin
When trying to run tox in parallel as explained on page 151, I got the following error: tox: error: argument -p/–parallel: expected one...
New
brunogirin
When running tox for the first time, I got the following error: ERROR: InterpreterNotFound: python3.10 I realised that I was running ...
New
AufHe
I’m a newbie to Rails 7 and have hit an issue with the bin/Dev script mentioned on pages 112-113. Iteration A1 - Seeing the list of prod...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
tkhobbes
After some hassle, I was able to finally run bin/setup, now I have started the rails server but I get this error message right when I vis...
New
Keton
When running the program in chapter 8, “Implementing Combat”, the printout Health before attack was never printed so I assumed something ...
New
bjnord
Hello @herbert ! Trying to get the very first “Hello, Bracket Terminal!" example to run (p. 53). I develop on an Amazon EC2 instance runn...
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
New
AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
AstonJ
We have a thread about the keyboards we have, but what about nice keyboards we come across that we want? If you have seen any that look n...
New
AstonJ
I’ve been hearing quite a lot of comments relating to the sound of a keyboard, with one of the most desirable of these called ‘thock’, he...
New
AstonJ
Saw this on TikTok of all places! :lol: Anyone heard of them before? Lite:
New
PragmaticBookshelf
Author Spotlight Mike Riley @mriley This month, we turn the spotlight on Mike Riley, author of Portable Python Projects. Mike’s book ...
New
husaindevelop
Inside our android webview app, we are trying to paste the copied content from another app eg (notes) using navigator.clipboard.readtext ...
New
sir.laksmana_wenk
I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc. However, I don’t...
New
AstonJ
If you’re getting errors like this: psql: error: connection to server on socket “/tmp/.s.PGSQL.5432” failed: No such file or directory ...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New

Sub Categories: