Skip to content

Commit 51dedf9

Browse files
authored
add tests for outside steps(connects #76 via #89)
1 parent da5d4db commit 51dedf9

File tree

7 files changed

+69
-16
lines changed

7 files changed

+69
-16
lines changed

allure-pytest/test/steps/nested_steps_test.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
4444
"""
4545
import pytest
46-
46+
import allure
4747
from itertools import product
4848

4949

@@ -54,17 +54,17 @@
5454
def test_nested_steps_inside_test(first_fail_before_second, first_fail_after_second, second_fail):
5555
with pytest.allure.step('First step'):
5656
assert not first_fail_before_second
57-
with pytest.allure.step('Second step'):
57+
with allure.step('Second step'):
5858
assert not second_fail
5959
assert not first_fail_after_second
6060

6161

62-
@pytest.allure.step("Second step")
62+
@allure.step("Second step")
6363
def second_step(second_fail):
6464
assert not second_fail
6565

6666

67-
@pytest.allure.step("First step")
67+
@allure.step("First step")
6868
def another_first_step(first_fail_before_second, first_fail_after_second, second_fail):
6969
assert not first_fail_before_second
7070
second_step(second_fail)
@@ -76,10 +76,10 @@ def test_nested_steps_outside_test(first_fail_before_second, first_fail_after_se
7676
another_first_step(first_fail_before_second, first_fail_after_second, second_fail)
7777

7878

79-
@pytest.allure.step("First step")
79+
@allure.step("First step")
8080
def yet_another_first_step(first_fail_before_second, first_fail_after_second, second_fail):
8181
assert not first_fail_before_second
82-
with pytest.allure.step('Second step'):
82+
with allure.step('Second step'):
8383
assert not second_fail
8484
assert not first_fail_after_second
8585

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import allure
2+
3+
4+
@allure.step('step in __init__.py')
5+
def init_step():
6+
pass
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import allure
2+
import pytest
3+
4+
5+
@allure.step('step in conftest.py')
6+
def conftest_step():
7+
pass
8+
9+
10+
@pytest.fixture
11+
def fixture_with_conftest_step():
12+
conftest_step()
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""
2+
>>> getfixture('inject_matchers')
3+
>>> allure_report = getfixture('allure_report')
4+
"""
5+
6+
from . import init_step
7+
8+
9+
def test_step_from_init_py():
10+
"""
11+
>>> allure_report = getfixture('allure_report')
12+
>>> assert_that(allure_report,
13+
... has_test_case('test_step_from_init_py',
14+
... has_step('step in __init__.py')
15+
... )
16+
... )
17+
"""
18+
init_step()
19+
20+
21+
def test_step_from_conftest(fixture_with_conftest_step):
22+
"""
23+
>>> allure_report = getfixture('allure_report')
24+
>>> assert_that(allure_report,
25+
... has_test_case('test_step_from_conftest',
26+
... has_container(allure_report,
27+
... has_before('fixture_with_conftest_step',
28+
... has_step('step in conftest.py')
29+
... )
30+
... )
31+
... )
32+
... )
33+
"""
34+
pass

allure-pytest/test/steps/placeholders_in_steps_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
... )) # doctest: +SKIP
99
"""
1010

11-
import pytest
11+
import allure
1212

1313

14-
@pytest.allure.step('arg is {0}')
14+
@allure.step('arg is {0}')
1515
def step_with_equal_args(step_arg_param):
1616
assert step_arg_param
1717

@@ -30,7 +30,7 @@ def test_equal_args_and_places():
3030
step_with_equal_args(True)
3131

3232

33-
@pytest.allure.step('arg is {0}')
33+
@allure.step('arg is {0}')
3434
def step_places_less(step_arg_param1, step_arg_param2):
3535
assert step_arg_param1 and step_arg_param2
3636

@@ -50,7 +50,7 @@ def test_places_less():
5050
step_places_less(True, True)
5151

5252

53-
@pytest.allure.step('arg are {0} and {1}')
53+
@allure.step('arg are {0} and {1}')
5454
def step_args_less(step_arg_param,):
5555
assert step_arg_param
5656

allure-pytest/test/steps/simple_steps_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535

3636

3737
import pytest
38+
import allure
3839

3940
from itertools import product
4041

@@ -44,18 +45,18 @@
4445

4546
@pytest.mark.parametrize("first_step_fail, second_step_fail", true_false)
4647
def test_sequence_of_inside_steps(first_step_fail, second_step_fail):
47-
with pytest.allure.step('First step'):
48+
with allure.step('First step'):
4849
assert not first_step_fail
49-
with pytest.allure.step('Second step'):
50+
with allure.step('Second step'):
5051
assert not second_step_fail
5152

5253

53-
@pytest.allure.step("First step")
54+
@allure.step("First step")
5455
def first_step(step_fail):
5556
assert not step_fail
5657

5758

58-
@pytest.allure.step("Second step")
59+
@allure.step("Second step")
5960
def second_step(step_fail):
6061
assert not step_fail
6162

allure-pytest/test/steps/step_parameters_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
>>> allure_report = getfixture('allure_report')
33
"""
44

5-
import pytest
5+
import allure
66

77

8-
@pytest.allure.step("First step")
8+
@allure.step("First step")
99
def step_with_parameters(step_fail, default_value=777, named_parameter=888):
1010
assert not step_fail
1111

0 commit comments

Comments
 (0)