diff --git a/core/dbt/task/debug.py b/core/dbt/task/debug.py index 748de5a38be..35f259c6ee4 100644 --- a/core/dbt/task/debug.py +++ b/core/dbt/task/debug.py @@ -69,7 +69,7 @@ def __init__(self, args, config): self.profiles_dir = getattr(self.args, 'profiles_dir', dbt.config.PROFILES_DIR) self.profile_path = os.path.join(self.profiles_dir, 'profiles.yml') - self.project_path = os.path.join(os.getcwd(), 'dbt_project.yml') + self.project_path = os.path.join(args.project_dir or os.getcwd(), 'dbt_project.yml') self.cli_vars = dbt.utils.parse_cli_vars( getattr(self.args, 'vars', '{}') ) diff --git a/test/integration/049_dbt_debug_test/test_debug.py b/test/integration/049_dbt_debug_test/test_debug.py index bdd4639e5bc..d2493eae152 100644 --- a/test/integration/049_dbt_debug_test/test_debug.py +++ b/test/integration/049_dbt_debug_test/test_debug.py @@ -103,3 +103,12 @@ def test_postgres_badproject(self): self.assertIn('ERROR invalid', line) elif line.strip().startswith('profiles.yml file'): self.assertNotIn('ERROR invalid', line) + + @use_profile('postgres') + def test_postgres_invalid_project_dir(self): + self.use_default_project() + self.run_dbt(['debug', '--project-dir', 'nopass']) + splitout = self.capsys.readouterr().out.split('\n') + for line in splitout: + if line.strip().startswith('dbt_project.yml file'): + self.assertIn('ERROR not found', line) \ No newline at end of file