mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
disable IntegrationPlugin loading from setup hook in testing
This commit is contained in:
parent
1391df7236
commit
013e8ab3bd
@ -55,7 +55,6 @@ def get_setting(environment_var, backup_val, default_value=None):
|
||||
|
||||
# Determine if we are running in "test" mode e.g. "manage.py test"
|
||||
TESTING = 'test' in sys.argv
|
||||
PLUGIN_TESTING = TESTING # used to forece enable everything plugin
|
||||
|
||||
# New requirement for django 3.2+
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||
@ -866,3 +865,7 @@ INTEGRATION_PLUGINS = {}
|
||||
INTEGRATION_PLUGINS_INACTIVE = {}
|
||||
INTEGRATION_PLUGIN_GLOBALSETTING = {}
|
||||
INTEGRATION_APPS_LOADED = False # Marks if apps were reloaded yet
|
||||
|
||||
# Test settings
|
||||
PLUGIN_TESTING = get_setting('PLUGIN_TESTING', TESTING) # used to force enable everything plugin
|
||||
PLUGIN_TESTING_SETUP = get_setting('PLUGIN_TESTING_SETUP', False)
|
||||
|
@ -42,11 +42,12 @@ class PluginAppConfig(AppConfig):
|
||||
if modules:
|
||||
[settings.PLUGINS.append(item) for item in modules]
|
||||
|
||||
# Collect plugins from setup entry points
|
||||
for entry in metadata.entry_points().get('inventree_plugins', []):
|
||||
plugin = entry.load()
|
||||
plugin.is_package = True
|
||||
settings.PLUGINS.append(plugin)
|
||||
if (not settings.PLUGIN_TESTING) or (settings.PLUGIN_TESTING and settings.PLUGIN_TESTING_SETUP):
|
||||
# Collect plugins from setup entry points
|
||||
for entry in metadata.entry_points().get('inventree_plugins', []):
|
||||
plugin = entry.load()
|
||||
plugin.is_package = True
|
||||
settings.PLUGINS.append(plugin)
|
||||
|
||||
# Log found plugins
|
||||
logger.info(f'Found {len(settings.PLUGINS)} plugins!')
|
||||
|
Loading…
Reference in New Issue
Block a user