Beispiel #1
0
            renderers/
            styles/
                data_docs_custom_styles.css
            views/
    uncommitted/
        config_variables.yml
        data_docs/
        validations/
"""
    )

    assert_no_logging_messages_or_tracebacks(my_caplog, result)


@pytest.mark.skipif(
    is_library_installed("pymysql"), reason="requires pymysql to NOT be installed"
)
def test_cli_init_db_mysql_without_library_installed_instructs_user(
    caplog, tmp_path_factory
):
    _library_not_loaded_test(
        tmp_path_factory, "Y\n2\n1\nmy_db\n", "pymysql", "pymysql", caplog
    )


@pytest.mark.skipif(
    is_library_installed("psycopg2"), reason="requires psycopg2 to NOT be installed"
)
def test_cli_init_db_postgres_without_library_installed_instructs_user(
    caplog, tmp_path_factory,
):
Beispiel #2
0
    assert res2.result["unexpected_count"] == 5


def test_result_format_warning(sa, unexpected_count_df):
    with pytest.warns(
            UserWarning,
            match=
            r"Setting result format to COMPLETE for a SqlAlchemyDataset can be dangerous",
    ):
        unexpected_count_df.expect_column_values_to_be_in_set(
            "a",
            value_set=[1],
            result_format={
                "result_format": "COMPLETE",
                "partial_unexpected_count": 2
            },
        )


@pytest.mark.skipif(
    is_library_installed("sqlalchemy_redshift"),
    reason="sqlalchemy_redshift must not be installed",
)
def test_dataset_attempt_allowing_relative_error_when_redshift_library_not_installed(
    sa, ):
    engine = sa.create_engine("sqlite://")
    dataset = SqlAlchemyDataset(engine=engine, custom_sql="select 1")

    assert isinstance(dataset, SqlAlchemyDataset)
    assert dataset.attempt_allowing_relative_error() is False
Beispiel #3
0
    plugins/
        custom_data_docs/
            renderers/
            styles/
                data_docs_custom_styles.css
            views/
    uncommitted/
        config_variables.yml
        data_docs/
        validations/
""")

    assert_no_logging_messages_or_tracebacks(my_caplog, result)


@pytest.mark.skipif(is_library_installed("pymysql"),
                    reason="requires pymysql to NOT be installed")
def test_cli_init_db_mysql_without_library_installed_instructs_user(
        caplog, tmp_path_factory):
    _library_not_loaded_test(tmp_path_factory, "Y\n2\n1\nmy_db\n", "pymysql",
                             "pymysql", caplog)


@pytest.mark.skipif(is_library_installed("psycopg2"),
                    reason="requires psycopg2 to NOT be installed")
def test_cli_init_db_postgres_without_library_installed_instructs_user(
    caplog,
    tmp_path_factory,
):
    _library_not_loaded_test(tmp_path_factory, "Y\n2\n2\nmy_db\n", "psycopg2",
                             "psycopg2", caplog)