Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pytest run all the bad test files

In the src/examples/testing/bad folder run pytest.

============================= test session starts ==============================
platform linux -- Python 3.13.7, pytest-9.0.2, pluggy-1.6.0
Test order randomisation NOT enabled. Enable with --random-order or --random-order-bucket=<bucket_type>
rootdir: /home/gabor/github/code-maven/python.code-maven.com
configfile: pyproject.toml
plugins: json-report-1.5.0, random-order-1.2.0, flake8-1.3.0, anyio-4.12.0, xdist-3.8.0, mypy-1.0.1, cov-7.0.0, metadata-3.1.1
collected 19 items

test_fibonacci_with_pytest.py .                                          [  5%]
test_fibonacci_with_pytest_failing.py F                                  [ 10%]
test_fibonacci_with_pytest_failing_separated.py F...                     [ 31%]
test_fibonacci_with_unittest.py .                                        [ 36%]
test_fibonacci_with_unittest_failure.py F                                [ 42%]
test_fibonacci_with_unittest_failure_separated.py F...                   [ 63%]
test_fibonacci_with_unittest_separated.py ...                            [ 78%]
test_mymath.py .                                                         [ 84%]
test_mymath_more.py F                                                    [ 89%]
test_mymath_more_separate.py .F                                          [100%]

=================================== FAILURES ===================================
___________________________________ test_fib ___________________________________

>   ???
E   assert 1 == 0
E    +  where 1 = fib(1)

/home/gabor/github/code-maven.com/python.code-maven.com/books/python-testing/src/examples/testing/bad/test_fibonacci_with_pytest_failing.py:5: AssertionError
__________________________________ test_fib_1 __________________________________

>   ???
E   assert 1 == 0
E    +  where 1 = fib(1)

/home/gabor/github/code-maven.com/python.code-maven.com/books/python-testing/src/examples/testing/bad/test_fibonacci_with_pytest_failing_separated.py:5: AssertionError
______________________________ TestFibo.test_fib _______________________________

self = <test_fibonacci_with_unittest_failure.TestFibo testMethod=test_fib>

>   ???
E   AssertionError: 1 != 0

/home/gabor/github/code-maven.com/python.code-maven.com/books/python-testing/src/examples/testing/bad/test_fibonacci_with_unittest_failure.py:7: AssertionError
_______________________________ TestFibo.test_1 ________________________________

self = <test_fibonacci_with_unittest_failure_separated.TestFibo testMethod=test_1>

>   ???
E   AssertionError: 1 != 0

/home/gabor/github/code-maven.com/python.code-maven.com/books/python-testing/src/examples/testing/bad/test_fibonacci_with_unittest_failure_separated.py:7: AssertionError
___________________________________ test_add ___________________________________

>   ???
E   assert 6 == 5
E    +  where 6 = <function add at 0x79cb29ee6a20>(2, 3)
E    +    where <function add at 0x79cb29ee6a20> = mymath.add

/home/gabor/github/code-maven.com/python.code-maven.com/books/python-testing/src/examples/testing/bad/test_mymath_more.py:6: AssertionError
__________________________________ test_again __________________________________

>   ???
E   assert 6 == 5
E    +  where 6 = <function add at 0x79cb29ee6a20>(2, 3)
E    +    where <function add at 0x79cb29ee6a20> = mymath.add

/home/gabor/github/code-maven.com/python.code-maven.com/books/python-testing/src/examples/testing/bad/test_mymath_more_separate.py:8: AssertionError
=========================== short test summary info ============================
FAILED test_fibonacci_with_pytest_failing.py::test_fib - assert 1 == 0
FAILED test_fibonacci_with_pytest_failing_separated.py::test_fib_1 - assert 1...
FAILED test_fibonacci_with_unittest_failure.py::TestFibo::test_fib - Assertio...
FAILED test_fibonacci_with_unittest_failure_separated.py::TestFibo::test_1 - ...
FAILED test_mymath_more.py::test_add - assert 6 == 5
FAILED test_mymath_more_separate.py::test_again - assert 6 == 5
========================= 6 failed, 13 passed in 0.08s =========================