Files
dlt/tests/pipeline/test_utils.py
David Scharf a3534b392d Simplify pipeline test utils (#2566)
* remove some duplicate test utils

* use dataset to get table counts

* add exception for sftp but use dataset otherwise for loading table counts and contents

* update checking of empty tables in filesystem tests

* support filesystemsqlclient for tables that have prefixes rather than folders

* fix table location resolution for internal tables

* make sftp check raise same errors as filesystemsqlclient

* more cleanup

* fix replace disposition tests

* simplify table count code in many places

* small cleanup

* fix tables to dicts function

* disable databricks and synapse ibis backend tests

(cherry picked from commit aba8de4706)

* simplify table assertions

* add tests for tests :)

* fix two tests

* fix dbt tests

* makes open table locations to work in windows fs

* review comments

* adds docstrings plus linting to pipeline utils

* fix docstring linting on utils class

* bump adlfs in lockfile

* test loading abfss first

* test getting tables one by one for azure

* fix resolving of sql_client

* change folder detection

* add comment for abfss fix
fix iceberg

* move abfss fallback into utils method

* normalizes trailing separator in paths in filesystem

* fixes two tests

* fix glob resolution for tables that have nested folders

* removes globs from duckdb filesystem sql client, adds tests for edge cases

* disables globbing for iceberg, adds optional autorefresh flag for view, fixes tests and docs

---------

Co-authored-by: Marcin Rudolf <rudolfix@rudolfix.org>
2025-05-30 13:18:45 +02:00

14 lines
438 B
Python

# test utils :)
import pytest
from tests.pipeline.utils import assert_records_as_set
def test_assert_records_as_set():
assert_records_as_set([{"a": 1}, {"a": 2}], [{"a": 2}, {"a": 1}])
assert_records_as_set([{"a": 1}, {"a": 1}], [{"a": 1}, {"a": 1}])
# test that a different number of the same recoreds actually fails
with pytest.raises(AssertionError):
assert_records_as_set([{"a": 1}, {"a": 1}], [{"a": 1}])