Skip to content

Commit 3918a03

Browse files
authored
Merge pull request #3754 from dbt-labs/backport_fix_remove_tests
[Backport] [#3711] Check that test unique_id exists in nodes when removing
2 parents 8246d97 + 5a3cfc9 commit 3918a03

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Under the hood
44
- Switch to full reparse on partial parsing exceptions. Log and report exception information. ([#3725](https://github.com/dbt-labs/dbt/issues/3725), [#3733](https://github.com/dbt-labs/dbt/pull/3733))
5+
- Check for existence of test node when removing. ([#3711](https://github.com/dbt-labs/dbt/issues/3711), [#3750](https://github.com/dbt-labs/dbt/pull/3750))
56

67

78
## dbt 0.20.1 (August 11, 2021)

core/dbt/parser/manifest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def load(self):
231231
"Switching to a full re-parse.")
232232

233233
# Get traceback info
234-
tb_info = traceback.format_exc(10)
234+
tb_info = traceback.format_exc()
235235
formatted_lines = tb_info.splitlines()
236236
(_, line, method) = formatted_lines[-3].split(', ')
237237
exc_info = {

core/dbt/parser/partial.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,9 @@ def delete_schema_mssa_links(self, schema_file, dict_key, elem):
654654
def remove_tests(self, schema_file, dict_key, name):
655655
tests = schema_file.get_tests(dict_key, name)
656656
for test_unique_id in tests:
657-
node = self.saved_manifest.nodes.pop(test_unique_id)
658-
self.deleted_manifest.nodes[test_unique_id] = node
657+
if test_unique_id in self.saved_manifest.nodes:
658+
node = self.saved_manifest.nodes.pop(test_unique_id)
659+
self.deleted_manifest.nodes[test_unique_id] = node
659660
schema_file.remove_tests(dict_key, name)
660661

661662
def delete_schema_source(self, schema_file, source_dict):

0 commit comments

Comments
 (0)