Test class reference

This page provides a partial reference to the attributes, methods, properties and class-level variables that are used to help configure a backend for the Ibis test suite.

Contributors are encouraged to look over the methods and class-level variables in ibis/backends/tests/base.py.

To add a new backend test configuration import one of BackendTest or ServiceBackendTest into a conftest.py file with the path ibis/backends/{backend_name}/tests/conftest.py. Then update / override the relevant class-level variables and methods.

from ibis.backends.tests.base import BackendTest

class TestConf(BackendTest):
    """Backend-specific class with information for testing."""

    returned_timestamp_unit = "us"
    supports_structs = True
    supports_json = True
    check_names = False
    force_sort = True

    @staticmethod
    def connect(*args, **kwargs):
        ...

BackendTest

BackendTest(self, *, data_dir, tmpdir, worker_id, **kw)

The base class for managing configuration and data loading for a backend that does not require Docker for testing (this includes both in-process backends and cloud backends like Snowflake and BigQuery).

Attributes

Name Description
check_dtype Check that dtypes match when comparing Pandas Series
check_names Check that column name matches when comparing Pandas Series
deps A list of dependencies that must be present to run tests.
driver_supports_multiple_statements Whether the driver supports executing multiple statements in a single call.
force_sort Sort results before comparing against reference computation.
native_bool Whether backend has native boolean types
reduction_tolerance Used for a single test in test_aggregation.py. You should not need to touch this.
rounding_method Name of round method to use for rounding test comparisons.
stateful Whether special handling is needed for running a multi-process pytest run.
supports_arrays Whether backend supports Arrays / Lists
supports_json Whether backend supports operating on JSON
supports_map Whether backend supports mappings (currently DuckDB, Snowflake, and Trino)
supports_structs Whether backend supports Structs
supports_tpcds Child class defines a load_tpcds method that loads the required TPC-DS tables into a connection.
supports_tpch Child class defines a load_tpch method that loads the required TPC-H tables into a connection.
tpc_absolute_tolerance Absolute tolerance for floating point comparisons with pytest.approx in TPC correctness tests.

Methods

Name Description
assert_frame_equal Compare two Pandas DataFrames optionally ignoring order, and dtype.
assert_series_equal Compare two Pandas Series, optionally ignoring order, dtype, and column name.
connect Return a connection with data loaded from data_dir.
load_data Load testdata from data_dir.
load_tpcds Load TPC-DS data.
load_tpch Load TPC-H data.
postload Code to execute after loading data.
preload Code to execute before loading data.
skip_if_missing_deps Add an importorskip for any missing dependencies.

assert_frame_equal

assert_frame_equal(left, right, *args, **kwargs)

Compare two Pandas DataFrames optionally ignoring order, and dtype.

force_sort, and check_dtype are set as class-level variables.

assert_series_equal

assert_series_equal(left, right, *args, **kwargs)

Compare two Pandas Series, optionally ignoring order, dtype, and column name.

force_sort, check_dtype, and check_names are set as class-level variables.

connect

connect(tmpdir, worker_id, **kw)

Return a connection with data loaded from data_dir.

load_data

load_data(data_dir, tmpdir, worker_id, **kw)

Load testdata from data_dir.

load_tpcds

load_tpcds()

Load TPC-DS data.

load_tpch

load_tpch()

Load TPC-H data.

postload

postload(**_)

Code to execute after loading data.

preload

preload()

Code to execute before loading data.

skip_if_missing_deps

skip_if_missing_deps()

Add an importorskip for any missing dependencies. # ServiceBackendTest { #ibis.backends.tests.base.ServiceBackendTest }

ServiceBackendTest(self, *, data_dir, tmpdir, worker_id, **kw)

Parent class to use for backend test configuration if backend requires a Docker container(s) in order to run locally.

Attributes

Name Description
data_volume Data volume defined in compose.yaml corresponding to backend.
service_name Name of service defined in compose.yaml corresponding to backend.
test_files Returns an iterable of test files to load into a Docker container before testing.

Methods

Name Description
preload Use docker compose cp to copy all files from test_files into a container.

preload

preload()

Use docker compose cp to copy all files from test_files into a container.

service_name and data_volume are set as class-level variables.

Back to top