From 2c2635cad931b6951b063a29539723da815a3ff3 Mon Sep 17 00:00:00 2001 From: Josh Temple <8672171+joshtemple@users.noreply.github.com> Date: Wed, 2 Mar 2022 12:25:56 -0500 Subject: [PATCH] Handle ephemeral state correctly Closes #522. --- spectacles/runner.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spectacles/runner.py b/spectacles/runner.py index 865726ac..f01ff8f1 100644 --- a/spectacles/runner.py +++ b/spectacles/runner.py @@ -250,8 +250,9 @@ def validate_sql( validator = SqlValidator(self.client, concurrency, runtime_threshold) tests: List[SqlTest] = [] + ephemeral = True if incremental else None # Create explore-level tests for the desired ref - with self.branch_manager(ref=ref, ephemeral=incremental): + with self.branch_manager(ref=ref, ephemeral=ephemeral): base_ref = self.branch_manager.ref # Resolve the full ref after checkout logger.debug("Building explore tests for the desired ref") project = build_project( @@ -322,7 +323,7 @@ def validate_sql( # Create dimension tests for the desired ref when explores errored if not fail_fast: - with self.branch_manager(ref=ref, ephemeral=incremental): + with self.branch_manager(ref=ref, ephemeral=ephemeral): base_ref = self.branch_manager.ref logger.debug("Building dimension tests for the desired ref") base_tests = validator.create_tests(project, at_dimension_level=True)