diff --git a/core/dbt/task/clean.py b/core/dbt/task/clean.py index 8632c6e29e2..b058507153a 100644 --- a/core/dbt/task/clean.py +++ b/core/dbt/task/clean.py @@ -2,7 +2,7 @@ import os import shutil -from dbt.task.base import BaseTask +from dbt.task.base import BaseTask, move_to_nearest_project_dir from dbt.logger import GLOBAL_LOGGER as logger from dbt.config import UnsetProfileConfig @@ -32,6 +32,7 @@ def run(self): This function takes all the paths in the target file and cleans the project paths that are not protected. """ + move_to_nearest_project_dir(self.args) for path in self.config.clean_targets: logger.info("Checking {}/*".format(path)) if not self.__is_protected_path(path): diff --git a/test/integration/015_cli_invocation_tests/test_cli_invocation.py b/test/integration/015_cli_invocation_tests/test_cli_invocation.py index 72c76846b24..270d5a73fef 100644 --- a/test/integration/015_cli_invocation_tests/test_cli_invocation.py +++ b/test/integration/015_cli_invocation_tests/test_cli_invocation.py @@ -168,3 +168,4 @@ def _run_simple_dbt_commands(self, 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]) + self.run_dbt(['clean', '--project-dir', project_dir])