Skip to content

Commit

Permalink
Execute dbt in debug mode for single test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kudryk committed May 30, 2024
1 parent d9081b7 commit 84d4773
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Feature: Python models with defined envs
Scenario: Run a project with a Python model that is calculated in a virtual environment
When the following shell command is invoked:
"""
dbt run --profiles-dir $profilesDir --project-dir $baseDir --select +model_c+
dbt --debug run --profiles-dir $profilesDir --project-dir $baseDir --select +model_c+
"""
Then the following models are calculated in order:
| model_a | model_c | model_d |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ def run_command_step(context):

#DEBUG
print(f"SHELL COMMAND: {command}")
# os.system(command)

try:
process = subprocess.run(command, shell=True, capture_output=True)
context.shell_stdout = process.stdout.decode("utf-8")
context.shell_stderr = process.stderr.decode("utf-8")

if process.returncode != 0:
raise subprocess.CalledProcessError(
process.returncode, command, context.shell_stdout, context.shell_stderr
)
except BaseException as e:
context.exc = e
os.system(command)

# try:
# process = subprocess.run(command, shell=True, capture_output=True)
# context.shell_stdout = process.stdout.decode("utf-8")
# context.shell_stderr = process.stderr.decode("utf-8")
#
# if process.returncode != 0:
# raise subprocess.CalledProcessError(
# process.returncode, command, context.shell_stdout, context.shell_stderr
# )
# except BaseException as e:
# context.exc = e

@then("there should be no errors")
def check_no_errors(context):
Expand Down

0 comments on commit 84d4773

Please sign in to comment.