@@ -21,7 +21,7 @@ or with ``diff`` mode highlighted via ``Pygments``:
2121 The plugin provides the fixtures :py:data: `expected_out ` and :py:data: `expected_err `.
2222Usage is straightforward as shown below:
2323
24- .. literalinclude :: ../test /test_foo.py
24+ .. literalinclude :: ../tests /test_foo.py
2525 :language: python
2626 :pyobject: test_foo
2727
@@ -30,33 +30,34 @@ If you run :command:`pytest` now, the test will be skipped because the expectati
3030.. code-block :: console
3131 :emphasize-lines: 5,6
3232
33- $ pytest --no-header --no-summary test /test_foo.py::test_foo
33+ $ pytest --no-header --no-summary tests /test_foo.py::test_foo
3434 ============================= test session starts ==============================
3535 collected 1 item
3636
37- test /test_foo.py::test_foo SKIPPED (Base directory for pattern-matcher
38- does not exist: `…/pytest-matcher/master/test /data/expected`) [100%]
37+ tests /test_foo.py::test_foo SKIPPED (Base directory for pattern-matcher
38+ does not exist: `…/pytest-matcher/master/tests /data/expected`) [100%]
3939
4040 ============================== 1 skipped in 0.01s ==============================
4141
4242
4343 Add the :option: `pm-patterns-base-dir ` option to the `Pytest configuration file `_
44- pointing, for example, to :file: `test /data/expected `. Run :command: `pytest ` with
44+ pointing, for example, to :file: `tests /data/expected `. Run :command: `pytest ` with
4545the :option: `--pm-save-patterns ` option to write the initial expectation file:
4646
4747.. code-block :: console
4848 :emphasize-lines: 5,6
4949
50- $ pytest --pm-save-patterns --no-header --no-summary test /test_foo.py::test_foo
50+ $ pytest --pm-save-patterns --no-header --no-summary tests /test_foo.py::test_foo
5151 ============================= test session starts ==============================
5252 collecting ... collected 1 item
5353
54- test /test_foo.py::test_foo SKIPPED (Pattern file saved to
55- `…/pytest-matcher/master/test /data/expected/test_foo/test_foo.out`) [100%]
54+ tests /test_foo.py::test_foo SKIPPED (Pattern file saved to
55+ `…/pytest-matcher/master/tests /data/expected/test_foo/test_foo.out`) [100%]
5656
5757 ============================== 1 skipped in 0.02s ==============================
5858
59- Review the stored pattern file :file: `test/data/expected/test_foo/test_foo.out ` and add it to your VCS.
59+ Review the stored pattern file :file: `tests/data/expected/test_foo/test_foo.out ` and add it to
60+ your VCS.
6061
6162.. note ::
6263
@@ -71,11 +72,11 @@ output matches expectations:
7172.. code-block :: console
7273 :emphasize-lines: 5
7374
74- $ pytest --no-header --no-summary test /test_foo.py::test_foo
75+ $ pytest --no-header --no-summary tests /test_foo.py::test_foo
7576 ============================= test session starts ==============================
7677 collected 1 item
7778
78- test /test_foo.py::test_foo PASSED [100%]
79+ tests /test_foo.py::test_foo PASSED [100%]
7980
8081 ============================== 1 passed in 0.01s ===============================
8182
@@ -85,20 +86,20 @@ output matches expectations:
8586If the captured output contains values that change from run to run, for example timestamps
8687or filesystem paths, you can match the output using regular expressions:
8788
88- .. literalinclude :: ../test /test_foo.py
89+ .. literalinclude :: ../tests /test_foo.py
8990 :language: python
9091 :pyobject: test_regex
9192
9293Store the pattern file for this test and rerun :command: `pytest ` with the ``-vv `` option:
9394
9495.. code-block :: console
95- :emphasize-lines: 24,28
96+ :emphasize-lines: 24,25,28,29
9697
97- $ pytest -vv --no-header test /test_foo.py::test_regex
98+ $ pytest -vv --no-header tests /test_foo.py::test_regex
9899 ============================= test session starts ==============================
99100 collecting ... collected 1 item
100101
101- test /test_foo.py::test_regex FAILED [100%]
102+ tests /test_foo.py::test_regex FAILED [100%]
102103
103104 =================================== FAILURES ===================================
104105 __________________________________ test_regex __________________________________
@@ -112,43 +113,43 @@ Store the pattern file for this test and rerun :command:`pytest` with the ``-vv`
112113
113114 stdout, _ = capfd.readouterr()
114115
115- > assert expected_out.match(stdout) ==True
116+ > assert expected_out.match(stdout) == True
116117 E AssertionError: assert
117118 E The test output doesn't match the expected regex.
118- E (from `…/pytest-matcher/master/test /data/expected/test_foo/test_regex.out`):
119+ E (from `…/pytest-matcher/master/tests /data/expected/test_foo/test_regex.out`):
119120 E ---[BEGIN actual output]---
120121 E Current date: 2024-03-02 21:59:03.792447
121- E Current module: …/pytest-matcher/master/test /test_foo.py
122+ E Current module: …/pytest-matcher/master/tests /test_foo.py
122123 E ---[END actual output]---
123124 E ---[BEGIN expected regex]---
124125 E Current date: 2024-03-02 21:58:32.289679
125- E Current module: …/pytest-matcher/master/test /test_foo.py
126+ E Current module: …/pytest-matcher/master/tests /test_foo.py
126127 E ---[END expected regex]---
127128
128- test /test_foo.py:26: AssertionError
129+ tests /test_foo.py:26: AssertionError
129130 =========================== short test summary info ============================
130- FAILED test /test_foo.py::test_regex - AssertionError: assert
131+ FAILED tests /test_foo.py::test_regex - AssertionError: assert
131132 ============================== 1 failed in 0.03s ===============================
132133
133134 To make it match, edit the expectation file and replace the changing parts with regular
134135expressions:
135136
136137.. code-block ::
137- :caption: ``test /data/expect/test_foo/test_regex.out``
138+ :caption: ``tests /data/expect/test_foo/test_regex.out``
138139
139140 Current date: [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]+)?
140- Current module: .*/test /test_foo.py
141+ Current module: .*/tests /test_foo.py
141142
142143 The test will now pass:
143144
144145.. code-block :: console
145146 :emphasize-lines: 5
146147
147- $ pytest --no-header --no-summary test /test_foo.py::test_regex
148+ $ pytest --no-header --no-summary tests /test_foo.py::test_regex
148149 ============================= test session starts ==============================
149150 collected 1 item
150151
151- test /test_foo.py::test_regex PASSED [100%]
152+ tests /test_foo.py::test_regex PASSED [100%]
152153
153154 ============================== 1 passed in 0.01s ===============================
154155
0 commit comments