|
|
@@ -1,17 +1,19 @@ |
|
|
from hamcrest import assert_that, not_ |
|
|
from hamcrest import assert_that, not_, anything |
|
|
from tests.allure_pytest.pytest_runner import AllurePytestRunner |
|
|
|
|
|
from allure_commons_test.report import has_test_case |
|
|
from allure_commons_test.label import has_tag |
|
|
|
|
|
|
|
|
def test_pytest_marker(allure_pytest_runner: AllurePytestRunner): |
|
|
def test_pytest_simple_markers_are_converted_to_allure_tags( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.cool |
|
|
... @pytest.mark.stuff |
|
|
... def test_pytest_marker_example(): |
|
|
... def test_pytest_simple_markers_are_converted_to_allure_tags_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -20,25 +22,21 @@ def test_pytest_marker(allure_pytest_runner: AllurePytestRunner): |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_marker_example", |
|
|
"test_pytest_simple_markers_are_converted_to_allure_tags_example", |
|
|
has_tag("cool"), |
|
|
has_tag("stuff") |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_show_reserved_pytest_markers_full_decorator( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
def test_pytest_marker_with_args_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.usermark1 |
|
|
... @pytest.mark.usermark2 |
|
|
... @pytest.mark.parametrize("param", ["foo"]) |
|
|
... @pytest.mark.skipif(False, reason="reason2") |
|
|
... @pytest.mark.skipif(False, reason="reason1") |
|
|
... def test_show_reserved_pytest_markers_full_decorator_example(param): |
|
|
>>> @pytest.mark.marker('cool', 'stuff') |
|
|
... def test_pytest_marker_with_args_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -47,26 +45,46 @@ def test_show_reserved_pytest_markers_full_decorator( |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_show_reserved_pytest_markers_full_decorator_example[foo]", |
|
|
has_tag("usermark1"), |
|
|
has_tag("usermark2"), |
|
|
has_tag("@pytest.mark.skipif(False, reason='reason1')"), |
|
|
"test_pytest_marker_with_args_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag("@pytest.mark.skipif(False, reason='reason2')") |
|
|
), |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_marker_with_kwargs_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.marker(stuff='cool') |
|
|
... def test_pytest_marker_with_kwargs_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
|
allure_results = allure_pytest_runner.run_docstring() |
|
|
|
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_marker_with_kwargs_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag("@pytest.mark.parametrize('param', ['foo'])") |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_xfail_marker(allure_pytest_runner: AllurePytestRunner): |
|
|
def test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.xfail(reason='this is unexpect pass') |
|
|
... def test_pytest_xfail_marker_example(): |
|
|
>>> @pytest.mark.usefixtures('test_fixture') |
|
|
... def test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -75,18 +93,22 @@ def test_pytest_xfail_marker(allure_pytest_runner: AllurePytestRunner): |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_xfail_marker_example", |
|
|
has_tag("@pytest.mark.xfail(reason='this is unexpect pass')") |
|
|
"test_pytest_reserved_marker_usefixtures_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_marker_with_args(allure_pytest_runner: AllurePytestRunner): |
|
|
def test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.marker('cool', 'stuff') |
|
|
... def test_pytest_marker_with_args_example(): |
|
|
>>> @pytest.mark.filterwarnings('ignore:val') |
|
|
... def test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -95,18 +117,22 @@ def test_pytest_marker_with_args(allure_pytest_runner: AllurePytestRunner): |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_marker_with_args_example", |
|
|
has_tag("marker('cool', 'stuff')") |
|
|
"test_pytest_reserved_marker_filterwarnings_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_marker_with_kwargs(allure_pytest_runner: AllurePytestRunner): |
|
|
def test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.marker(stuff='cool') |
|
|
... def test_pytest_marker_with_kwargs_example(): |
|
|
>>> @pytest.mark.skip(reason='reason') |
|
|
... def test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -115,20 +141,22 @@ def test_pytest_marker_with_kwargs(allure_pytest_runner: AllurePytestRunner): |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_marker_with_kwargs_example", |
|
|
has_tag("marker(stuff='cool')") |
|
|
"test_pytest_reserved_marker_skip_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_marker_with_kwargs_native_encoding( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
def test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.marker(stuff='я') |
|
|
... def test_pytest_marker_with_kwargs_native_encoding_example(): |
|
|
>>> @pytest.mark.skipif(False, reason='reason') |
|
|
... def test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -137,20 +165,22 @@ def test_pytest_marker_with_kwargs_native_encoding( |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_marker_with_kwargs_native_encoding_example", |
|
|
has_tag("marker(stuff='я')") |
|
|
"test_pytest_reserved_marker_skipif_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_marker_with_kwargs_utf_encoding( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
def test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.marker(stuff='я') |
|
|
... def test_pytest_marker_with_kwargs_utf_encoding_example(): |
|
|
>>> @pytest.mark.xfail(reason='this is unexpect pass') |
|
|
... def test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag_example(): |
|
|
... pass |
|
|
""" |
|
|
|
|
Expand All
|
@@ -159,7 +189,33 @@ def test_pytest_marker_with_kwargs_utf_encoding( |
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_marker_with_kwargs_utf_encoding_example", |
|
|
has_tag("marker(stuff='я')") |
|
|
"test_pytest_reserved_marker_xfail_is_not_converted_to_allure_tag_example", |
|
|
not_( |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
def test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag( |
|
|
allure_pytest_runner: AllurePytestRunner |
|
|
): |
|
|
""" |
|
|
>>> import pytest |
|
|
|
|
|
>>> @pytest.mark.parametrize("param", ["foo"]) |
|
|
... def test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag_example(param): |
|
|
... pass |
|
|
""" |
|
|
|
|
|
allure_results = allure_pytest_runner.run_docstring() |
|
|
|
|
|
assert_that( |
|
|
allure_results, |
|
|
has_test_case( |
|
|
"test_pytest_reserved_marker_parametrize_is_not_converted_to_allure_tag_example[foo]", |
|
|
not_( |
|
|
has_tag(anything()) |
|
|
) |
|
|
) |
|
|
) |