Skip to content

Commit 0b8069c

Browse files
authored
Merge pull request #630 from chisholm/fix-register-cleanup
Fix unit test cleanup bug in relational datastore test suite
2 parents 580771e + 53364d4 commit 0b8069c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

stix2/test/v21/test_datastore_relational_db.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -687,15 +687,13 @@ class TestClass:
687687

688688
try:
689689
yield TestClass
690-
except: # noqa: E722
690+
finally:
691691
ext_id = kwargs.get("extension_name")
692692
if not ext_id and len(args) >= 3:
693693
ext_id = args[2]
694694

695695
_unregister("objects", TestClass._type, ext_id)
696696

697-
raise
698-
699697

700698
@contextlib.contextmanager
701699
def _register_observable(*args, **kwargs):
@@ -713,15 +711,13 @@ class TestClass:
713711

714712
try:
715713
yield TestClass
716-
except: # noqa: E722
714+
finally:
717715
ext_id = kwargs.get("extension_name")
718716
if not ext_id and len(args) >= 4:
719717
ext_id = args[3]
720718

721719
_unregister("observables", TestClass._type, ext_id)
722720

723-
raise
724-
725721

726722
# "Base" properties used to derive property variations for testing (e.g. in a
727723
# list, in a dictionary, in an embedded object, etc). Also includes sample

0 commit comments

Comments
 (0)