def test_step_with_thread_and_attachment(allured_testdir): allured_testdir.testdir.makepyfile(""" from concurrent.futures import ThreadPoolExecutor import allure import pytest @allure.step("thread {x}") def parallel_step(x=1): allure.attach("text", str(x), allure.attachment_type.TEXT) def test_thread(): with allure.step("Start in thread"): with ThreadPoolExecutor(max_workers=2) as executor: f_result = executor.map(parallel_step, [1, 2]) """) allured_testdir.run_with_allure() assert_that( allured_testdir.allure_report, has_test_case( "test_thread", has_step( "Start in thread", has_step("thread 1", has_attachment(name="1")), has_step("thread 2", has_attachment(name="2")), )))
def test_step_with_attachment(executed_docstring_path): assert_that( executed_docstring_path.allure_report, has_test_case( "test_step_with_attachment", has_step("step_with_attachment", has_attachment()), ))
def test_attach_body(executed_docstring_path): assert_that( executed_docstring_path.allure_report, has_test_case( "test_attach_body", has_attachment(attach_type="application/xml", name="some attachment name")))
def test_step_with_attachment(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_step_with_attachment", has_step("step_with_attachment", has_attachment() ), ) )
def test_fixture_attachment(executed_docstring_path): assert_that( executed_docstring_path.allure_report, has_test_case( "test_fixture_attachment", has_container( executed_docstring_path.allure_report, has_before("fixture_with_attachment", has_attachment()))))
def test_fixture_finalizer_attachment(executed_docstring_path): assert_that( executed_docstring_path.allure_report, has_test_case( "test_fixture_finalizer_attachment", has_container( executed_docstring_path.allure_report, has_after("fixture_with_attachment_in_finalizer::finalizer", has_attachment()))))
def test_fixture_attachment(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_fixture_attachment", has_container(executed_docstring_path.allure_report, has_before("fixture_with_attachment", has_attachment() ) ) ) )
def test_fixture_finalizer_attachment(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_fixture_finalizer_attachment", has_container(executed_docstring_path.allure_report, has_after("fixture_with_attachment_in_finalizer::finalizer", 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")))
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") ) )
def test_parametrized_attachment(executed_docstring_source, param): """ >>> import pytest >>> @pytest.mark.parametrize("param", ["first", "second"]) ... def test_parametrized_attachment_example(param): ... assert param """ assert_that( executed_docstring_source.allure_report, has_test_case( "test_parametrized_attachment_example[{param}]".format( param=param), has_attachment()))
def test_attach_from_runtest_teardown(allured_testdir): allured_testdir.testdir.makeconftest(""" import allure def pytest_runtest_teardown(*args, **kwargs): allure.attach(body="body", name="attachment from teardown") """) allured_testdir.testdir.makepyfile(""" def test_attach_from_runtest_teardown(): pass """) allured_testdir.run_with_allure() assert_that(allured_testdir.allure_report, has_test_case("test_attach_from_runtest_teardown", has_attachment(name="attachment from teardown"), ) )
def has_step_with_keyword_log(step_name, *matchers): return has_step( step_name, has_attachment(attach_type='text/html', name='Keyword Log'), *matchers)
def test_attach_body_with_default_kwargs(executed_docstring_path): assert_that( executed_docstring_path.allure_report, has_test_case("test_attach_body_with_default_kwargs", has_attachment()))
def test_attach_file(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_attach_file", has_attachment() ) )
def test_attach_body_with_default_kwargs(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_attach_body_with_default_kwargs", has_attachment() ) )
def test_attach_file(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_attach_file", has_attachment()))
def test_attach_body(executed_docstring_path): assert_that(executed_docstring_path.allure_report, has_test_case("test_attach_body", has_attachment(attach_type="application/xml", name="some attachment name") ) )