Skip to content

Commit 54864f0

Browse files
bugfix: fix imports for simple example
1 parent ba969d2 commit 54864f0

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

doc/en/example/simple.rst

+42-5
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,9 @@ here is a little example implemented via a local plugin:
892892
.. code-block:: python
893893
894894
# content of conftest.py
895-
895+
from typing import Dict
896896
import pytest
897+
from pytest import StashKey, CollectReport
897898
898899
phase_report_key = StashKey[Dict[str, CollectReport]]()
899900
@@ -951,10 +952,46 @@ and run it:
951952
.. code-block:: pytest
952953
953954
$ pytest -s test_module.py
954-
ImportError while loading conftest '/home/sweet/project/conftest.py'.
955-
conftest.py:4: in <module>
956-
phase_report_key = StashKey[Dict[str, CollectReport]]()
957-
E NameError: name 'StashKey' is not defined
955+
=========================== test session starts ============================
956+
platform linux -- Python 3.x.y, pytest-7.x.y, pluggy-1.x.y
957+
rootdir: /home/sweet/project
958+
collected 3 items
959+
960+
test_module.py Esetting up a test failed or skipped test_module.py::test_setup_fails
961+
Fexecuting test failed or skipped test_module.py::test_call_fails
962+
F
963+
964+
================================== ERRORS ==================================
965+
____________________ ERROR at setup of test_setup_fails ____________________
966+
967+
@pytest.fixture
968+
def other():
969+
> assert 0
970+
E assert 0
971+
972+
test_module.py:7: AssertionError
973+
================================= FAILURES =================================
974+
_____________________________ test_call_fails ______________________________
975+
976+
something = None
977+
978+
def test_call_fails(something):
979+
> assert 0
980+
E assert 0
981+
982+
test_module.py:15: AssertionError
983+
________________________________ test_fail2 ________________________________
984+
985+
def test_fail2():
986+
> assert 0
987+
E assert 0
988+
989+
test_module.py:19: AssertionError
990+
========================= short test summary info ==========================
991+
FAILED test_module.py::test_call_fails - assert 0
992+
FAILED test_module.py::test_fail2 - assert 0
993+
ERROR test_module.py::test_setup_fails - assert 0
994+
======================== 2 failed, 1 error in 0.12s ========================
958995
959996
You'll see that the fixture finalizers could use the precise reporting
960997
information.

doc/en/getting-started.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Install ``pytest``
2222
.. code-block:: bash
2323
2424
$ pytest --version
25-
pytest 7.2.0.dev533+gd08c8e337
25+
pytest 7.2.0.dev534+ga2c84caaa.d20230317
2626
2727
.. _`simpletest`:
2828

0 commit comments

Comments
 (0)