-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
07438c1
commit 76c1bf8
Showing
23 changed files
with
717 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.DS_Store | ||
.idea | ||
.tox | ||
.cache | ||
.pytest_cache | ||
.python-version | ||
|
||
*.pyc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import pytest | ||
|
||
|
||
def test_passed(): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_passed', | ||
... with_status('passed') | ||
... ) | ||
... ) | ||
""" | ||
pass | ||
|
||
|
||
def test_failed(): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_failed', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("AssertionError"), | ||
... with_trace_contains("def test_failed():") | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
assert False | ||
|
||
|
||
def test_broken(): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_broken', | ||
... with_status('broken'), | ||
... has_status_details(with_message_contains("IndentationError"), | ||
... with_trace_contains("def test_broken():") | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
raise IndentationError() | ||
|
||
|
||
def test_call_pytest_fail(): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_call_pytest_fail', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("Failed: <Failed instance>"), | ||
... with_trace_contains("def test_call_pytest_fail():") | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
pytest.fail() | ||
|
||
|
||
def test_call_pytest_fail_with_reason(): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_call_pytest_fail_with_reason', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("Fail message"), | ||
... with_trace_contains("def test_call_pytest_fail():") | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
pytest.fail("Fail message") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def failed_fixture(): | ||
assert False | ||
|
||
|
||
def test_failed_fixture(failed_fixture): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_failed_fixture', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("AssertionError"), | ||
... with_trace_contains("def failed_fixture():") | ||
... ), | ||
... has_container(allure_report, | ||
... has_before('failed_fixture', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("AssertionError"), | ||
... with_trace_contains("failed_fixture") | ||
... ), | ||
... ), | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
pass | ||
|
||
|
||
@pytest.fixture | ||
def broken_fixture(): | ||
raise IndexError | ||
|
||
|
||
def test_broken_fixture(broken_fixture): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_broken_fixture', | ||
... with_status('broken'), | ||
... has_status_details(with_message_contains("IndexError"), | ||
... with_trace_contains("def broken_fixture():") | ||
... ), | ||
... has_container(allure_report, | ||
... has_before('broken_fixture', | ||
... with_status('broken'), | ||
... has_status_details(with_message_contains("IndexError"), | ||
... with_trace_contains("broken_fixture") | ||
... ), | ||
... ), | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
pass | ||
|
||
|
||
@pytest.fixture | ||
def skip_fixture(): | ||
pytest.skip() | ||
|
||
|
||
def test_skip_fixture(skip_fixture): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_skip_fixture', | ||
... with_status('skipped'), | ||
... has_status_details(with_message_contains("Skipped: <Skipped instance>")), | ||
... has_container(allure_report, | ||
... has_before('skip_fixture', | ||
... with_status('skipped'), | ||
... has_status_details(with_message_contains("Skipped: <Skipped instance>"), | ||
... with_trace_contains("skip_fixture") | ||
... ), | ||
... ), | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
|
||
|
||
@pytest.fixture | ||
def pytest_fail_fixture(): | ||
pytest.fail() | ||
|
||
|
||
def test_pytest_fail_fixture(pytest_fail_fixture): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_pytest_fail_fixture', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("Failed: <Failed instance>"), | ||
... with_trace_contains("def pytest_fail_fixture():") | ||
... ), | ||
... has_container(allure_report, | ||
... has_before('pytest_fail_fixture', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("Failed: <Failed instance>"), | ||
... with_trace_contains("pytest_fail_fixture") | ||
... ), | ||
... ), | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
pass | ||
|
||
|
||
@pytest.fixture | ||
def pytest_fail_with_reason_fixture(): | ||
pytest.fail("Fail message") | ||
|
||
|
||
def test_pytest_fail_with_reason_fixture(pytest_fail_with_reason_fixture): | ||
""" | ||
>>> allure_report = getfixture('allure_report') | ||
>>> assert_that(allure_report, | ||
... has_test_case('test_pytest_fail_with_reason_fixture', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("Fail message"), | ||
... with_trace_contains("def pytest_fail_with_reason_fixture():") | ||
... ), | ||
... has_container(allure_report, | ||
... has_before('pytest_fail_with_reason_fixture', | ||
... with_status('failed'), | ||
... has_status_details(with_message_contains("Fail message"), | ||
... with_trace_contains("pytest_fail_with_reason_fixture") | ||
... ), | ||
... ), | ||
... ) | ||
... ) | ||
... ) | ||
""" | ||
pass | ||
|
||
|
Oops, something went wrong.