From 7c0da8febacb69142e7bcf61d076c72190957208 Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Tue, 19 Nov 2024 17:50:10 -0800 Subject: [PATCH] Troubleshoot module reloading in unit tests --- tests/models/test_base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/models/test_base.py b/tests/models/test_base.py index e2f3b72..0665af8 100644 --- a/tests/models/test_base.py +++ b/tests/models/test_base.py @@ -27,7 +27,6 @@ import importlib import os from datetime import datetime, timedelta - from unittest import TestCase from time import time from pydantic import ValidationError @@ -57,7 +56,11 @@ def test_base_model(self): self.assertEqual(model.model_config["extra"], "ignore") self.assertEqual(allowed.model_config["extra"], "allow") - importlib.reload(neon_data_models.models.base) + # Ensure modules are unloaded for future inheritance tests + import sys + for module in list(sys.modules.keys()): + if module.startswith("neon_data_models"): + del sys.modules[module] def test_base_model_inheritance(self): from neon_data_models.models.base import BaseModel