Skip to content

Commit e92285b

Browse files
authored
Merge pull request #506 from pytest-dev/filenames-in-codeblocks
Move the filenames in the code block itself.
2 parents 4d5443f + 503be82 commit e92285b

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

README.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ Example
4444
An example test for a blog hosting software could look like this.
4545
Note that pytest-splinter_ is used to get the browser fixture.
4646

47-
publish_article.feature:
48-
4947
.. code-block:: gherkin
5048
49+
# content of publish_article.feature
50+
5151
Feature: Blog
5252
A site where you can publish your articles.
5353
@@ -63,10 +63,10 @@ publish_article.feature:
6363
6464
Note that only one feature is allowed per feature file.
6565

66-
test_publish_article.py:
67-
6866
.. code-block:: python
6967
68+
# content of test_publish_article.py
69+
7070
from pytest_bdd import scenario, given, when, then
7171
7272
@scenario('publish_article.feature', 'Publishing the article')
@@ -349,7 +349,7 @@ A common use case is when we have to assert the outcome of an HTTP request:
349349

350350
.. code-block:: python
351351
352-
# test_blog.py
352+
# content of test_blog.py
353353
354354
from pytest_bdd import scenarios, given, when, then
355355
@@ -375,7 +375,7 @@ A common use case is when we have to assert the outcome of an HTTP request:
375375
376376
.. code-block:: gherkin
377377
378-
# blog.feature
378+
# content of blog.feature
379379
380380
Feature: Blog
381381
Scenario: Deleting the article
@@ -754,18 +754,18 @@ Reusing steps
754754
It is possible to define some common steps in the parent conftest.py and
755755
simply expect them in the child test file.
756756

757-
common_steps.feature:
758-
759757
.. code-block:: gherkin
760758
759+
# content of common_steps.feature
760+
761761
Scenario: All steps are declared in the conftest
762762
Given I have a bar
763763
Then bar should have value "bar"
764764
765-
conftest.py:
766-
767765
.. code-block:: python
768766
767+
# content of conftest.py
768+
769769
from pytest_bdd import given, then
770770
771771
@@ -778,10 +778,10 @@ conftest.py:
778778
def bar_is_bar(bar):
779779
assert bar == "bar"
780780
781-
test_common.py:
782-
783781
.. code-block:: python
784782
783+
# content of test_common.py
784+
785785
@scenario("common_steps.feature", "All steps are declared in the conftest")
786786
def test_conftest():
787787
pass
@@ -846,10 +846,10 @@ Avoid retyping the feature file name
846846
If you want to avoid retyping the feature file name when defining your scenarios in a test file, use ``functools.partial``.
847847
This will make your life much easier when defining multiple scenarios in a test file. For example:
848848

849-
test_publish_article.py:
850-
851849
.. code-block:: python
852850
851+
# content of test_publish_article.py
852+
853853
from functools import partial
854854
855855
import pytest_bdd

0 commit comments

Comments
 (0)