From 76b4eb67a7c89108fe5a387205be7773b8e12559 Mon Sep 17 00:00:00 2001 From: Benjamin Adams Date: Tue, 16 Apr 2024 12:46:08 -0400 Subject: [PATCH] Suppress MockNetCDF __dealloc__ exceptions rather than overriding --- compliance_checker/tests/helpers.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compliance_checker/tests/helpers.py b/compliance_checker/tests/helpers.py index 40a9ea87..78b4649c 100644 --- a/compliance_checker/tests/helpers.py +++ b/compliance_checker/tests/helpers.py @@ -1,6 +1,6 @@ import tempfile -from netCDF4 import Dataset +from netCDF4._netCDF4 import Dataset class MockNetCDF(Dataset): @@ -26,7 +26,10 @@ def __init__(self, filename=None): # suppress usual dealloc routine to prevent caught exception messages # from printing def __dealloc__(self): - pass + try: + super().__dealloc__() + except AttributeError: + pass class MockTimeSeries(MockNetCDF): """