Skip to content

Commit

Permalink
fix --no-compile flag for docs generate
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Feb 4, 2020
1 parent ccab27a commit 137e42d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion core/dbt/task/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
)
from dbt.exceptions import InternalException
from dbt.include.global_project import DOCS_INDEX_FILE_PATH
from dbt.perf_utils import get_full_manifest
import dbt.ui.printer
import dbt.utils
import dbt.compilation
Expand Down Expand Up @@ -195,6 +196,8 @@ def run(self):
'compile failed, cannot generate docs'
)
return CatalogResults({}, datetime.utcnow(), compile_results)
else:
self.manifest = get_full_manifest(self.config)

shutil.copyfile(
DOCS_INDEX_FILE_PATH,
Expand Down Expand Up @@ -224,7 +227,8 @@ def run(self):

path = os.path.join(self.config.target_path, CATALOG_FILENAME)
results.write(path)
write_manifest(self.config, self.manifest)
if self.args.compile:
write_manifest(self.config, self.manifest)

dbt.ui.printer.print_timestamped_line(
'Catalog written to {}'.format(os.path.abspath(path))
Expand Down
12 changes: 10 additions & 2 deletions test/integration/029_docs_generate_tests/test_docs_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def project_config(self):
}
}

def run_and_generate(self, extra=None, seed_count=1, model_count=1, alternate_db=None):
def run_and_generate(self, args=None, extra=None, seed_count=1, model_count=1, alternate_db=None):
if alternate_db is None:
alternate_db = self.alternative_database
project = {
Expand All @@ -150,7 +150,10 @@ def run_and_generate(self, extra=None, seed_count=1, model_count=1, alternate_db
os.remove(normalize('target/manifest.json'))
os.remove(normalize('target/run_results.json'))
self.generate_start_time = datetime.utcnow()
self.run_dbt(['docs', 'generate', vars_arg])
base_args = ['docs', 'generate', vars_arg]
if args:
base_args.extend(args)
self.run_dbt(base_args)

def _no_stats(self):
return {
Expand Down Expand Up @@ -3393,6 +3396,11 @@ def verify_run_results(self, expected_run_results):
run_result['results'].sort(key=lambda r: r['node']['unique_id'])
self.assertEqual(run_result['results'], expected_run_results)

@use_profile('postgres')
def test__postgres__run_and_generate_no_compile(self):
self.run_and_generate(alternate_db=self.default_database, args=['--no-compile'])
self.verify_catalog(self.expected_postgres_catalog())

@use_profile('postgres')
def test__postgres__run_and_generate(self):
self.run_and_generate(alternate_db=self.default_database)
Expand Down

0 comments on commit 137e42d

Please sign in to comment.