def test_feature_to_rst_unique_integrated_background_step_format(feature_file):
    unique_background_step_format = "{} *(Background)*"
    results = writer.feature_to_rst(
        feature_file,
        feature_file.parent,
        integrate_background=True,
        background_step_format=unique_background_step_format,
    )
    expected_output = rst_output.basic_rst_unique_integrated_background_step_format
    assert results._output == expected_output
def test_filter_by_tags_logic_is_triggered(tags_feature_file):
    # All the variations are tested in test_utils.test_get_all_included_scenarios,
    # so this just makes sure that logic get triggered within the writer.py module.
    results = writer.feature_to_rst(
        tags_feature_file,
        tags_feature_file.parent,
        # An include tag that should cause the feature to be excluded,
        # meaning the include/exclude helper has indeed been triggered.
        include_tags=["some-tag-no-scenario-or-feature-has"],
    )
    assert results is None
def test_feature_to_rst_tags_converted_to_url(tags_feature_file):
    def get_url_from_tag(tag):
        if "with_url" in tag:
            return "https://github.com/jolly-good-toolbelt/sphinx_gherkindoc"

        return ""

    results = writer.feature_to_rst(tags_feature_file,
                                    tags_feature_file.parent,
                                    get_url_from_tag=get_url_from_tag)
    assert results._output == rst_output.tags_rst_with_urls
def test_feature_to_rst_steps_converted_to_url(feature_file):
    def get_url_from_step(step):
        if step == "Given a test feature":
            return "https://github.com/jolly-good-toolbelt/sphinx_gherkindoc"

        return ""

    results = writer.feature_to_rst(feature_file,
                                    feature_file.parent,
                                    get_url_from_step=get_url_from_step)
    assert results._output == rst_output.basic_rst_with_step_url
def test_feature_to_rst_integrated_background(feature_file):
    results = writer.feature_to_rst(feature_file,
                                    feature_file.parent,
                                    integrate_background=True)
    assert results._output == rst_output.basic_rst_with_integrated_background
def test_feature_to_rst(feature_file):
    results = writer.feature_to_rst(feature_file, feature_file.parent)
    assert results._output == rst_output.basic_rst
def test_feature_to_rst_inherited_tags(tags_feature_file):
    results = writer.feature_to_rst(tags_feature_file,
                                    tags_feature_file.parent)
    assert results._output == rst_output.tags_rst
Esempio n. 8
0
def pytest_writer(*args, **kwargs):
    return writer.feature_to_rst(*args, **kwargs, feature_parser="pytest_bdd")