forked from repo-mirrors/sqlfluff
Test dbt Templater Plugin with dbt 1.9.0 (#6280)
This commit is contained in:
committed by
GitHub
parent
99b3f9261b
commit
8f26aa0736
2
.github/workflows/ci-test-dbt.yml
vendored
2
.github/workflows/ci-test-dbt.yml
vendored
@@ -32,6 +32,8 @@ jobs:
|
||||
modular-python-test:
|
||||
name: py${{ inputs.python-version }}-${{ inputs.dbt-version }}
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
FORCE_COLOR: 1
|
||||
|
||||
services:
|
||||
# Label used to access the service container
|
||||
|
||||
9
.github/workflows/ci-tests.yml
vendored
9
.github/workflows/ci-tests.yml
vendored
@@ -71,8 +71,15 @@ jobs:
|
||||
dbt-tests:
|
||||
name: dbt Plugin Tests
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
dbt-version: [ dbt140, dbt150, dbt160, dbt170, dbt180 ]
|
||||
dbt-version:
|
||||
- dbt140
|
||||
- dbt150
|
||||
- dbt160
|
||||
- dbt170
|
||||
- dbt180
|
||||
- dbt190
|
||||
include:
|
||||
# Default to python 3.12 for dbt tests.
|
||||
- python-version: "3.12"
|
||||
|
||||
2
constraints/dbt190-winpy.txt
Normal file
2
constraints/dbt190-winpy.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
dbt-core~=1.9.0b1
|
||||
dbt-postgres~=1.9.0b1
|
||||
2
constraints/dbt190.txt
Normal file
2
constraints/dbt190.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
dbt-core~=1.9.0b1
|
||||
dbt-postgres~=1.9.0b1
|
||||
@@ -3,6 +3,7 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
from importlib import metadata
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
@@ -11,6 +12,14 @@ from sqlfluff.core import FluffConfig
|
||||
from sqlfluff_templater_dbt.templater import DbtTemplater
|
||||
|
||||
|
||||
def pytest_report_header() -> list[str]:
|
||||
"""Return a list of strings to be displayed in the header of the report."""
|
||||
return [
|
||||
f"dbt-core: {metadata.version('dbt-core')}",
|
||||
f"dbt-postgres: {metadata.version('dbt-postgres')}",
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def dbt_flags():
|
||||
"""Set dbt flags for dbt templater tests."""
|
||||
|
||||
6
tox.ini
6
tox.ini
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = generate-fixture-yml, linting, doclinting, ruleslinting, docbuild, cov-init, doctests, py{38,39,310,311,312}, dbt{140,150,160,170,180}, cov-report, mypy, winpy, dbt{150,180}-winpy, yamllint
|
||||
envlist = generate-fixture-yml, linting, doclinting, ruleslinting, docbuild, cov-init, doctests, py{38,39,310,311,312}, dbt{140,150,160,170,180,190}, cov-report, mypy, winpy, dbt{150,180,190}-winpy, yamllint
|
||||
min_version = 4.0 # Require 4.0+ for proper pyproject.toml support
|
||||
|
||||
[testenv]
|
||||
@@ -20,7 +20,7 @@ deps =
|
||||
# we force the right installation version up front in each environment.
|
||||
# NOTE: This is a bit of a hack around tox, but it does achieve reasonably
|
||||
# consistent results.
|
||||
dbt{140,150,160,170,180,}: -r {toxinidir}/constraints/{envname}.txt
|
||||
dbt{140,150,160,170,180,190}: -r {toxinidir}/constraints/{envname}.txt
|
||||
# Include any other steps necessary for testing below.
|
||||
# {posargs} is there to allow us to specify specific tests, which
|
||||
# can then be invoked from tox by calling e.g.
|
||||
@@ -32,7 +32,7 @@ commands =
|
||||
# number pinned to the same version number of the main sqlfluff library
|
||||
# so it _must_ be installed second in the context of a version which isn't
|
||||
# yet released (and so not available on pypi).
|
||||
dbt{140,150,160,170,180,}: python -m pip install {toxinidir}/plugins/sqlfluff-templater-dbt
|
||||
dbt{140,150,160,170,180,190}: python -m pip install {toxinidir}/plugins/sqlfluff-templater-dbt
|
||||
# Add the example plugin.
|
||||
# NOTE: The trailing comma is important because in the github test suite
|
||||
# the python version is not specified and instead the "py" environment
|
||||
|
||||
Reference in New Issue
Block a user