-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update UnsetProfileConfig.from_args to use args.project_dir if passed #2339
Changes from 5 commits
a376d65
72d2cab
66f9ee0
dda9289
d5f5095
2a0f69a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
from test.integration.base import DBTIntegrationTest, use_profile | ||
import os | ||
import shutil | ||
import tempfile | ||
import yaml | ||
|
||
|
||
|
@@ -111,3 +112,31 @@ def test_postgres_toplevel_dbt_run_with_profile_dir_arg(self): | |
# make sure the test runs against `custom_schema` | ||
for test_result in res: | ||
self.assertTrue(self.custom_schema, test_result.node.injected_sql) | ||
|
||
|
||
class TestCLIInvocationWithProjectDir(ModelCopyingIntegrationTest): | ||
|
||
@property | ||
def schema(self): | ||
return "test_cli_invocation_015" | ||
|
||
@property | ||
def models(self): | ||
return "models" | ||
|
||
@use_profile('postgres') | ||
def test_postgres_dbt_commands_with_cwd_as_project_dir(self): | ||
self._run_simple_dbt_commands(os.getcwd()) | ||
|
||
@use_profile('postgres') | ||
def test_postgres_dbt_commands_with_randomdir_as_project_dir(self): | ||
workdir = os.getcwd() | ||
with tempfile.TemporaryDirectory() as tmpdir: | ||
os.chdir(tmpdir) | ||
self._run_simple_dbt_commands(workdir) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we will need an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense, changes done. and also curious: would this be caught in tests (i.e. does dbt run tests w/ windows)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup! I'm about to kick them off now, I just didn't want to run the full test suite and then have to re-run later. Running tests for external contributors isn't quite as friction-free as we'd like yet. https://dev.azure.com/fishtown-analytics/dbt/_build/results?buildId=1798&view=results - it's the blue rocket ship link in the "checks" section There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see HAHA, that's awesome, I assume it's a lot of resources to use to run all these tests 😛 Appreciate it. |
||
|
||
def _run_simple_dbt_commands(self, project_dir): | ||
self.run_dbt(['deps', '--project-dir', project_dir]) | ||
self.run_dbt(['seed', '--project-dir', project_dir]) | ||
self.run_dbt(['run', '--project-dir', project_dir]) | ||
self.run_dbt(['test', '--project-dir', project_dir]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What!? How did I not know about this context manager? This is awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha I found out about it today!