Skip to content

Commit 5721d46

Browse files
authored
remove deprecated pytest namespace (via #312)
1 parent df6876e commit 5721d46

13 files changed

+48
-49
lines changed

allure-pytest/src/plugin.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,3 @@ def pytest_collection_modifyitems(items, config):
132132
config.option.allure_severities)
133133

134134
items[:] = filter(lambda item: arg_labels & set(allure_labels(item)) if arg_labels else True, items)
135-
136-
137-
def pytest_namespace():
138-
return {"allure": allure}

allure-pytest/test/attachments/attachments_fixtures_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
@pytest.fixture
88
def attach_file_in_function_scope_fixture(svg_file):
9-
allure.attach.file(svg_file, attachment_type=pytest.allure.attachment_type.SVG)
9+
allure.attach.file(svg_file, attachment_type=allure.attachment_type.SVG)
1010

1111

1212
def test_attach_file_in_function_scope_fixture(attach_file_in_function_scope_fixture):
@@ -44,7 +44,7 @@ def test_attach_file_in_reused_function_scope_fixture(attach_file_in_function_sc
4444
@pytest.fixture
4545
def attach_file_in_function_scope_finalizer(svg_file, request):
4646
def finalizer_function_scope_fixture():
47-
allure.attach.file(svg_file, attachment_type=pytest.allure.attachment_type.SVG)
47+
allure.attach.file(svg_file, attachment_type=allure.attachment_type.SVG)
4848
request.addfinalizer(finalizer_function_scope_fixture)
4949

5050

allure-pytest/test/attachments/attachments_test.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_attach_file_from_test_with_name_and_type(xml_file):
3434
... has_attachment(attach_type='application/xml', name='my name')
3535
... ))
3636
"""
37-
allure.attach.file(xml_file, name='my name', attachment_type=pytest.allure.attachment_type.XML)
37+
allure.attach.file(xml_file, name='my name', attachment_type=allure.attachment_type.XML)
3838

3939

4040
def test_attach_data_from_test_with_name_and_type(xml_body):
@@ -45,7 +45,7 @@ def test_attach_data_from_test_with_name_and_type(xml_body):
4545
... has_attachment(attach_type='application/xml', name='my name')
4646
... ))
4747
"""
48-
allure.attach(xml_body, name='my name', attachment_type=pytest.allure.attachment_type.XML)
48+
allure.attach(xml_body, name='my name', attachment_type=allure.attachment_type.XML)
4949

5050

5151
def test_attach_file_from_test_with_user_type(xml_file):
@@ -71,7 +71,7 @@ def test_attach_data_from_test_with_user_type(xml_body):
7171

7272

7373
def attach_svg_file(svg_file):
74-
allure.attach.file(svg_file, attachment_type=pytest.allure.attachment_type.SVG)
74+
allure.attach.file(svg_file, attachment_type=allure.attachment_type.SVG)
7575

7676

7777
def test_attach_file_from_function(svg_file):
@@ -96,7 +96,7 @@ def test_many_attaches(svg_file, xml_body):
9696
... ))
9797
"""
9898
attach_svg_file(svg_file)
99-
allure.attach(xml_body, attachment_type=pytest.allure.attachment_type.XML)
99+
allure.attach(xml_body, attachment_type=allure.attachment_type.XML)
100100

101101

102102
def test_attach_from_step(svg_file, xml_body):
@@ -115,6 +115,6 @@ def test_attach_from_step(svg_file, xml_body):
115115
... )
116116
"""
117117
with allure.step('Step with attachment'):
118-
allure.attach.file(svg_file, attachment_type=pytest.allure.attachment_type.SVG)
119-
with pytest.allure.step('Nested step with attachment'):
120-
allure.attach(xml_body, attachment_type=pytest.allure.attachment_type.XML)
118+
allure.attach.file(svg_file, attachment_type=allure.attachment_type.SVG)
119+
with allure.step('Nested step with attachment'):
120+
allure.attach(xml_body, attachment_type=allure.attachment_type.XML)

allure-pytest/test/filtering/severity_label_test.py

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

10-
import pytest
10+
import allure
1111

1212

13-
@pytest.allure.severity(pytest.allure.severity_level.TRIVIAL)
13+
@allure.severity(allure.severity_level.TRIVIAL)
1414
def test_function_with_trivial_severity():
1515
"""
1616
>>> allure_report = getfixture('allure_report_with_params')('--allure-severities=trivial')
@@ -25,7 +25,7 @@ def test_function_with_trivial_severity():
2525

2626
class TestClass(object):
2727

28-
@pytest.allure.severity(pytest.allure.severity_level.TRIVIAL)
28+
@allure.severity(allure.severity_level.TRIVIAL)
2929
def test_method_with_trivial_severity(self):
3030
"""
3131
>>> allure_report = getfixture('allure_report_with_params')('--allure-severities=trivial')
@@ -37,7 +37,7 @@ def test_method_with_trivial_severity(self):
3737
"""
3838
pass
3939

40-
@pytest.allure.severity(pytest.allure.severity_level.NORMAL)
40+
@allure.severity(allure.severity_level.NORMAL)
4141
def test_method_with_normal_severity(self):
4242
"""
4343
>>> from hamcrest import not_
@@ -49,7 +49,7 @@ def test_method_with_normal_severity(self):
4949
pass
5050

5151

52-
@pytest.allure.severity(pytest.allure.severity_level.TRIVIAL)
52+
@allure.severity(allure.severity_level.TRIVIAL)
5353
class TestClassAgain(object):
5454

5555
def test_method_with_whole_class_trivial_severity(self):
@@ -63,7 +63,7 @@ def test_method_with_whole_class_trivial_severity(self):
6363
"""
6464
pass
6565

66-
@pytest.allure.severity(pytest.allure.severity_level.NORMAL)
66+
@allure.severity(allure.severity_level.NORMAL)
6767
def test_method_with_overridden_class_severity(self):
6868
"""
6969
>>> from hamcrest import not_

allure-pytest/test/labels/severity/class_severity_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"""
1010

1111

12-
import pytest
12+
import allure
1313

1414

15-
@pytest.allure.severity(pytest.allure.severity_level.TRIVIAL)
15+
@allure.severity(allure.severity_level.TRIVIAL)
1616
class TestDecoratedClass(object):
1717

1818
def test_not_decorated_method(self):
@@ -26,7 +26,7 @@ def test_not_decorated_method(self):
2626
"""
2727
pass
2828

29-
@pytest.allure.severity(pytest.allure.severity_level.MINOR)
29+
@allure.severity(allure.severity_level.MINOR)
3030
def test_decorated_method(self):
3131
"""
3232
>>> allure_report = getfixture('allure_report')
@@ -54,7 +54,7 @@ def test_not_decorated_method(self):
5454
"""
5555
pass
5656

57-
@pytest.allure.severity(pytest.allure.severity_level.CRITICAL)
57+
@allure.severity(allure.severity_level.CRITICAL)
5858
def test_decorated_method(self):
5959
"""
6060
>>> allure_report = getfixture('allure_report')

allure-pytest/test/labels/severity/function_severity_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import pytest
1+
import allure
22

33

4-
@pytest.allure.severity(pytest.allure.severity_level.MINOR)
4+
@allure.severity(allure.severity_level.MINOR)
55
def test_decorated_function():
66
"""
77
>>> allure_report = getfixture('allure_report')

allure-pytest/test/labels/severity/module_severity_test.py

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

10-
import pytest
10+
import allure
1111

12-
pytestmark = pytest.allure.severity(pytest.allure.severity_level.TRIVIAL)
12+
pytestmark = allure.severity(allure.severity_level.TRIVIAL)
1313

1414

1515
def test_not_decorated_function():
@@ -24,7 +24,7 @@ def test_not_decorated_function():
2424
pass
2525

2626

27-
@pytest.allure.severity(pytest.allure.severity_level.MINOR)
27+
@allure.severity(allure.severity_level.MINOR)
2828
def test_decorated_function():
2929
"""
3030
>>> allure_report = getfixture('allure_report')
@@ -51,7 +51,7 @@ def test_method_of_not_decorated_class(self):
5151
pass
5252

5353

54-
@pytest.allure.severity(pytest.allure.severity_level.NORMAL)
54+
@allure.severity(allure.severity_level.NORMAL)
5555
class TestDecorated(object):
5656

5757
def test_method_of_decorated_class(self):

allure-pytest/test/links/function_links_test.py

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

11-
import pytest
11+
import allure
1212

1313
LINK = 'http://qameta.io'
1414
LINK_NAME = 'QAMETA'
@@ -20,7 +20,7 @@
2020
TEST_CASE_NAME = 'Comment with spec'
2121

2222

23-
@pytest.allure.link(LINK)
23+
@allure.link(LINK)
2424
def test_single_link():
2525
"""
2626
>>> allure_report = getfixture('allure_report')
@@ -33,7 +33,7 @@ def test_single_link():
3333
pass
3434

3535

36-
@pytest.allure.link(LINK, name=LINK_NAME)
36+
@allure.link(LINK, name=LINK_NAME)
3737
def test_single_named_link():
3838
"""
3939
>>> allure_report = getfixture('allure_report')
@@ -46,7 +46,7 @@ def test_single_named_link():
4646
pass
4747

4848

49-
@pytest.allure.link(LINK, name=LINK_NAME, link_type=LINK_TYPE)
49+
@allure.link(LINK, name=LINK_NAME, link_type=LINK_TYPE)
5050
def test_single_named_link_with_custom_type():
5151
"""
5252
>>> allure_report = getfixture('allure_report')
@@ -58,7 +58,7 @@ def test_single_named_link_with_custom_type():
5858
pass
5959

6060

61-
@pytest.allure.issue(ISSUE)
61+
@allure.issue(ISSUE)
6262
def test_single_issue():
6363
"""
6464
>>> allure_report = getfixture('allure_report')
@@ -70,7 +70,7 @@ def test_single_issue():
7070
pass
7171

7272

73-
@pytest.allure.testcase(TEST_CASE)
73+
@allure.testcase(TEST_CASE)
7474
def test_single_test_case():
7575
"""
7676
>>> allure_report = getfixture('allure_report')
@@ -82,9 +82,9 @@ def test_single_test_case():
8282
pass
8383

8484

85-
@pytest.allure.link(LINK, name=LINK_NAME, link_type=LINK_TYPE)
86-
@pytest.allure.testcase(TEST_CASE, name=TEST_CASE_NAME)
87-
@pytest.allure.issue(ISSUE, name=ISSUE_NAME)
85+
@allure.link(LINK, name=LINK_NAME, link_type=LINK_TYPE)
86+
@allure.testcase(TEST_CASE, name=TEST_CASE_NAME)
87+
@allure.issue(ISSUE, name=ISSUE_NAME)
8888
def test_with_links_cases_and_issues():
8989
"""
9090
>>> allure_report = getfixture('allure_report')
@@ -98,8 +98,8 @@ def test_with_links_cases_and_issues():
9898
pass
9999

100100

101-
@pytest.allure.testcase(TEST_CASE, name="First")
102-
@pytest.allure.testcase(ANOTHER_TEST_CASE, name="Second")
101+
@allure.testcase(TEST_CASE, name="First")
102+
@allure.testcase(ANOTHER_TEST_CASE, name="Second")
103103
def test_multiply_some_type_links():
104104
"""
105105
>>> allure_report = getfixture('allure_report')

allure-pytest/test/links/links_pattern_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
CUSTOM_LINK = 'pytest'
1010

1111

12-
@pytest.allure.issue(ISSUE)
13-
@pytest.allure.link(CUSTOM_LINK, link_type=CUSTOM_LINK_TYPE)
12+
@allure.issue(ISSUE)
13+
@allure.link(CUSTOM_LINK, link_type=CUSTOM_LINK_TYPE)
1414
def test_link_pattern():
1515
"""
1616
>>> allure_report = getfixture('allure_report_with_params')('--allure-link-pattern=issue:{pattern}'.format(

allure-pytest/test/status/base_step_status_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# -*- coding: utf-8 -*-
22
import pytest
3+
import allure
34

45

56
def test_broken_step():
@@ -20,7 +21,7 @@ def test_broken_step():
2021
... )
2122
... )
2223
"""
23-
with pytest.allure.step('Step'):
24+
with allure.step('Step'):
2425
raise ZeroDivisionError
2526

2627

@@ -42,7 +43,7 @@ def test_pytest_fail_in_step():
4243
... )
4344
... )
4445
"""
45-
with pytest.allure.step('Step'):
46+
with allure.step('Step'):
4647
pytest.fail()
4748

4849

@@ -64,5 +65,5 @@ def test_pytest_bytes_data_in_assert():
6465
... )
6566
... )
6667
"""
67-
with pytest.allure.step('Step'):
68+
with allure.step('Step'):
6869
assert '0\x82' == 1

0 commit comments

Comments
 (0)