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."""
= True
supports_divide_by_zero = False
supports_floating_modulus = "us"
returned_timestamp_unit = True
supports_structs = True
supports_json = False
check_names = True
force_sort
@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 |
default_identifier_case_fn | Function applied to all identifier names to change case as necessary (e.g. Snowflake ALL_CAPS) |
deps | A list of dependencies that must be present to run tests. |
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_arrays_outside_of_select | Whether backend supports Arrays / Lists outside of Select Statements |
supports_divide_by_zero | Whether backend supports division by zero |
supports_floating_modulus | Whether backend supports floating point in modulus operations |
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_tpch | Child class defines a load_tpch method that loads the required TPC-H tables into a connection. |
supports_window_operations | Whether backend supports Window Operations |
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 . |
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
.
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.