Skip to content

Commit

Permalink
Troubleshoot module reloading in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 20, 2024
1 parent f243426 commit 7c0da8f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/models/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7c0da8f

Please sign in to comment.