File tree Expand file tree Collapse file tree 7 files changed +92
-11
lines changed Expand file tree Collapse file tree 7 files changed +92
-11
lines changed Original file line number Diff line number Diff line change @@ -11,14 +11,9 @@ RUN mkdir -p /tmp/dbt-sqlite-tests
1111
1212RUN cd /tmp/dbt-sqlite-tests && wget https://github.com/nalgeon/sqlean/releases/download/0.12.2/crypto.so
1313
14- RUN pip install dbt-core~=1.0.0
15-
16- # NOTE: dbt 0.19.x doesn't work with pytest-dbt-adapter >= 0.5.0; use 0.4.0
17- # see https://github.com/dbt-labs/dbt-adapter-tests/issues/20
18- #
19- # pytest-dbt-adapter 0.6.0 doesn't seem to work with dbt 0.21.1,
20- # I think it's intended for the forthcoming 1.0.0 dbt release?
21- RUN pip install pytest-dbt-adapter==0.6.0
14+ RUN pip install dbt-core~=1.1.0
15+
16+ RUN pip install pytest pytest-dotenv dbt-tests-adapter==1.1.0
2217
2318# dbt-sqlite overrides some stuff pertaining to 'docs generate'
2419# so exercise it using jaffle_shop repo
Original file line number Diff line number Diff line change 1- version = '1.0.1 '
1+ version = '1.1.0 '
Original file line number Diff line number Diff line change @@ -244,7 +244,7 @@ def timestamp_add_sql(
244244 def drop_schema (self , relation : BaseRelation ) -> None :
245245 super ().drop_schema (relation )
246246
247- # can't detach a databse in the middle of a transaction, so commit first.
247+ # can't detach a database in the middle of a transaction, so commit first.
248248 # I wonder if drop_schema() in SQLAdapter should do this, since create_schema() does.
249249 self .commit_if_has_connection ()
250250
Original file line number Diff line number Diff line change 1+ [pytest]
2+ filterwarnings =
3+ ignore:.*' soft_unicode' has been renamed to ' soft_str' *:DeprecationWarning
4+ ignore:unclosed file .*:ResourceWarning
5+ env_files =
6+ test.env # uses pytest-dotenv plugin
7+ # this allows you to store env vars for database connection in a file named test.env
8+ # rather than passing them in every CLI command, or setting in `PYTEST_ADDOPTS`
9+ # be sure to add "test.env" to .gitignore as well!
10+ testpaths =
11+ tests/functional # name per convention
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ pip install -e .
55# Leaving the database file between runs of pytest can mess up subsequent test runs.
66# Since this runs in a fresh container each time, it's not an issue.
77
8- pytest test/sqlite.dbtspec
8+ python3 -m pytest tests/functional
99
1010# ###
1111
Original file line number Diff line number Diff line change 1+ import pytest
2+ import os
3+
4+ # Import the standard functional fixtures as a plugin
5+ # Note: fixtures with session scope need to be local
6+ pytest_plugins = ["dbt.tests.fixtures.project" ]
7+
8+ # The profile dictionary, used to write out profiles.yml
9+ # dbt will supply a unique schema per test, so we do not specify 'schema' here
10+ @pytest .fixture (scope = "class" )
11+ def dbt_profile_target ():
12+ return {
13+ 'type' : 'sqlite' ,
14+ 'threads' : 1 ,
15+ 'database' : 'adapter_test' ,
16+ 'schema' : 'main' ,
17+ 'schemas_and_paths' : {
18+ 'main' : '/tmp/dbt-sqlite-tests/adapter_test.db'
19+ },
20+ 'schema_directory' : '/tmp/dbt-sqlite-tests' ,
21+ 'extensions' : [
22+ "/tmp/dbt-sqlite-tests/crypto.so"
23+ ]
24+ }
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from dbt .tests .adapter .basic .test_base import BaseSimpleMaterializations
4+ from dbt .tests .adapter .basic .test_singular_tests import BaseSingularTests
5+ from dbt .tests .adapter .basic .test_singular_tests_ephemeral import BaseSingularTestsEphemeral
6+ from dbt .tests .adapter .basic .test_empty import BaseEmpty
7+ from dbt .tests .adapter .basic .test_ephemeral import BaseEphemeral
8+ from dbt .tests .adapter .basic .test_incremental import BaseIncremental
9+ from dbt .tests .adapter .basic .test_generic_tests import BaseGenericTests
10+ from dbt .tests .adapter .basic .test_snapshot_check_cols import BaseSnapshotCheckCols
11+ from dbt .tests .adapter .basic .test_snapshot_timestamp import BaseSnapshotTimestamp
12+ from dbt .tests .adapter .basic .test_adapter_methods import BaseAdapterMethod
13+
14+ class TestSimpleMaterializationsSqlite (BaseSimpleMaterializations ):
15+ pass
16+
17+
18+ class TestSingularTestsSqlite (BaseSingularTests ):
19+ pass
20+
21+
22+ class TestSingularTestsEphemeralSqlite (BaseSingularTestsEphemeral ):
23+ pass
24+
25+
26+ class TestEmptySqlite (BaseEmpty ):
27+ pass
28+
29+
30+ class TestEphemeralSqlite (BaseEphemeral ):
31+ pass
32+
33+
34+ class TestIncrementalSqlite (BaseIncremental ):
35+ pass
36+
37+
38+ class TestGenericTestsSqlite (BaseGenericTests ):
39+ pass
40+
41+
42+ class TestSnapshotCheckColsSqlite (BaseSnapshotCheckCols ):
43+ pass
44+
45+
46+ class TestSnapshotTimestampSqlite (BaseSnapshotTimestamp ):
47+ pass
48+
49+
50+ class TestBaseAdapterMethod (BaseAdapterMethod ):
51+ pass
You can’t perform that action at this time.
0 commit comments