From 461a0b9441ca098917d461f545ea7effe2ebdaa8 Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Tue, 19 Feb 2019 21:17:30 +0300 Subject: [PATCH 1/2] improve allure-pytest testing --- .../attachment/attachment_class_test.py | 19 +++++++++++++++++++ .../pytest_flakes/pytest_flakes_test.py | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 allure-pytest/test/acceptance/attachment/attachment_class_test.py diff --git a/allure-pytest/test/acceptance/attachment/attachment_class_test.py b/allure-pytest/test/acceptance/attachment/attachment_class_test.py new file mode 100644 index 00000000..fd03856d --- /dev/null +++ b/allure-pytest/test/acceptance/attachment/attachment_class_test.py @@ -0,0 +1,19 @@ +from hamcrest import assert_that +from allure_commons_test.report import has_test_case +from allure_commons_test.result import has_attachment + + +def test_class_method_attachment(executed_docstring_source): + """ + >>> import allure + + >>> class TestClass(object): + ... def test_class_method_attachment(self): + ... allure.attach("text", "failed", allure.attachment_type.TEXT) + """ + + assert_that(executed_docstring_source.allure_report, + has_test_case("test_class_method_attachment", + has_attachment(name="failed") + ) + ) diff --git a/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py b/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py index 1496d692..9ef07c8c 100644 --- a/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py +++ b/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py @@ -1,8 +1,10 @@ +import allure from hamcrest import assert_that from allure_commons_test.report import has_test_case from allure_commons_test.result import with_status +@allure.issue("352") def test_pytest_flakes(allured_testdir): """ >>> from os.path import * @@ -16,7 +18,7 @@ def test_pytest_flakes(allured_testdir): assert_that(allured_testdir.allure_report, has_test_case("test_pytest_flakes.py", with_status("broken") - ), + ), ) From 5321699f84de04cd2152b02fb6e46f47b7545a6b Mon Sep 17 00:00:00 2001 From: Stas Seliverstov Date: Tue, 19 Feb 2019 21:32:03 +0300 Subject: [PATCH 2/2] fix test --- .../test/integration/pytest_flakes/pytest_flakes_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py b/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py index 9ef07c8c..d296aaf2 100644 --- a/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py +++ b/allure-pytest/test/integration/pytest_flakes/pytest_flakes_test.py @@ -18,7 +18,7 @@ def test_pytest_flakes(allured_testdir): assert_that(allured_testdir.allure_report, has_test_case("test_pytest_flakes.py", with_status("broken") - ), + ), )