Skip to content

Commit b32841a

Browse files
authored
Support dbt 1.5 (#34)
* Add testing for dbt 1.5 * Add change log entry * Bump dbt minor version * Bump flake8 pre-commit version * Add threads to args * Set flags using set_from_args * Add comment about the arguments which are None * Add profiles dir to dbt deps command * Update changelog entry
1 parent b843a41 commit b32841a

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

Diff for: .pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ repos:
3131
- id: autoflake
3232
args: ['--in-place', '--remove-all-unused-imports']
3333
- repo: https://github.com/pycqa/flake8
34-
rev: 3.9.2
34+
rev: 5.0.4
3535
hooks:
3636
- id: flake8
3737
name: Run flake8 linter

Diff for: CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
- Support dbt v1.5 ([PR](https://github.com/godatadriven/pytest-dbt-core/pull/34))
2+
13
## [0.2.0] - 2023-03-01
24

35
- Add example with column rename macro ([PR](https://github.com/godatadriven/pytest-dbt-core/pull/19))

Diff for: setup.cfg

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ classifiers =
2121
packages = find:
2222
package_dir = =src
2323
install_requires =
24-
dbt-core>=1.0.0,<1.5.0
24+
dbt-core>=1.0.0,<1.6.0
2525
python_requires = >=3.7
2626

2727
[options.packages.find]
@@ -70,7 +70,7 @@ spark_options =
7070
spark.sql.catalogImplementation: in-memory
7171

7272
[tox:tox]
73-
envlist = py{3.7,3.8,3.9,3.10}-dbt-spark{11,12,13,14}
73+
envlist = py{3.7,3.8,3.9,3.10}-dbt-spark{11,12,13,14,15}
7474
isolated_build = true
7575
skip_missing_interpreters = true
7676

@@ -89,6 +89,7 @@ deps =
8989
dbt-spark12: dbt-spark[ODBC]~=1.2.0
9090
dbt-spark13: dbt-spark[ODBC]~=1.3.0
9191
dbt-spark14: dbt-spark[ODBC]~=1.4.0
92+
dbt-spark15: dbt-spark[ODBC]~=1.5.0
9293
pip >= 19.3.1
9394
extras = test
9495
commands = pytest {posargs:tests}
@@ -106,7 +107,8 @@ deps =
106107
dbt-spark12: dbt-spark[ODBC]~=1.2.0
107108
dbt-spark13: dbt-spark[ODBC]~=1.3.0
108109
dbt-spark14: dbt-spark[ODBC]~=1.4.0
110+
dbt-spark15: dbt-spark[ODBC]~=1.5.0
109111
pip >= 19.3.1
110112
extras = test
111-
commands_pre = dbt deps --project-dir {toxinidir}/docs/source/_static/dbt_project
113+
commands_pre = dbt deps --project-dir {toxinidir}/docs/source/_static/dbt_project --profiles-dir {toxinidir}/docs/source/_static/dbt_project
112114
commands = pytest {posargs:docs/source/_static/dbt_project/tests} --dbt-project-dir={toxinidir}/docs/source/_static/dbt_project --profiles-dir={toxinidir}/docs/source/_static/dbt_project

Diff for: src/pytest_dbt_core/fixtures.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ class Args:
4141
"""
4242

4343
project_dir: str
44+
profiles_dir: str
4445
target: str | None
4546
profile: str | None
47+
threads: int | None
4648

4749

4850
@pytest.fixture
@@ -60,16 +62,17 @@ def config(request: SubRequest) -> RuntimeConfig:
6062
RuntimeConfig
6163
The runtime config.
6264
"""
63-
64-
profiles_dir = request.config.getoption("--profiles-dir")
65-
if profiles_dir:
66-
flags.PROFILES_DIR = os.path.abspath(profiles_dir)
67-
65+
# For the arguments that are hardcoded to `None`, dbt internals set the
66+
# appropiate values
6867
args = Args(
6968
project_dir=request.config.getoption("--dbt-project-dir"),
69+
profiles_dir=request.config.getoption("--profiles-dir"),
7070
target=request.config.getoption("--dbt-target"),
7171
profile=None,
72+
threads=None,
7273
)
74+
flags.set_from_args(args, user_config=None)
75+
7376
config = RuntimeConfig.from_args(args)
7477
return config
7578

0 commit comments

Comments
 (0)