Skip to content

Commit

Permalink
Handle dbt flags based on version
Browse files Browse the repository at this point in the history
  • Loading branch information
JCZuurmond committed Jun 2, 2024
1 parent c51f8ef commit 37932dc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/pytest_dbt_core/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import dbt.tracking
import pytest
from _pytest.fixtures import SubRequest
from dbt import flags
from dbt import flags, version
from dbt.clients.jinja import MacroGenerator
from dbt.config import project
from dbt.config.runtime import RuntimeConfig
from dbt.context import providers
from dbt.contracts.graph.manifest import Manifest
from dbt.parser.manifest import ManifestLoader
from dbt.semver import VersionSpecifier
from dbt.tracking import User

from dbt.adapters.factory import ( # isort:skip
Expand Down Expand Up @@ -71,7 +73,15 @@ def config(request: SubRequest) -> RuntimeConfig:
profile=None,
threads=None,
)
flags.set_from_args(args, user_config=None)

if VersionSpecifier("1", "5", "12") < version.get_installed_version():
# See https://github.com/dbt-labs/dbt-core/issues/9183
project_flags = project.read_project_flags(
args.project_dir, args.profiles_dir
)
flags.set_from_args(args, project_flags)
else:
flags.set_from_args(args, user_config=None)

config = RuntimeConfig.from_args(args)
return config
Expand Down

0 comments on commit 37932dc

Please sign in to comment.