Skip to content

Commit 89d9fee

Browse files
committed
#338 remove global exception handler on _all_migrations_applied
1 parent c2a40e8 commit 89d9fee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

netbox_custom_objects/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ def ready(self):
7676
"ignore", category=UserWarning, message=".*database.*"
7777
)
7878

79-
# Skip database calls if running during migration or if table doesn't exist
80-
# or if not all migrations have been applied yet
79+
# Skip database calls if running during migration or tests, or if not all migrations have been applied yet
8180
if (
8281
self._is_running_migration()
82+
or self._is_running_test()
8383
or not self._all_migrations_applied()
8484
):
8585
super().ready()
@@ -148,10 +148,11 @@ def get_models(self, include_auto_created=False, include_swapped=False):
148148
"ignore", category=UserWarning, message=".*database.*"
149149
)
150150

151-
# Skip custom object type model loading if running during migration
151+
# Skip custom object type model loading if running during migration or tests,
152152
# or if not all migrations have been applied yet
153153
if (
154154
self._is_running_migration()
155+
or self._is_running_test()
155156
or not self._all_migrations_applied()
156157
):
157158
return

0 commit comments

Comments
 (0)