2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 12:06:44 +00:00

app not ready can not be simulated by tests

This commit is contained in:
Matthias 2022-02-13 17:34:05 +01:00
parent 2838817e32
commit fe65f92df0
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 8 additions and 8 deletions

View File

@ -103,7 +103,7 @@ class InvenTreeConfig(AppConfig):
from InvenTree.tasks import update_exchange_rates from InvenTree.tasks import update_exchange_rates
from common.settings import currency_code_default from common.settings import currency_code_default
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
pass pass
base_currency = currency_code_default() base_currency = currency_code_default()

View File

@ -127,7 +127,7 @@ def heartbeat():
try: try:
from django_q.models import Success from django_q.models import Success
logger.info("Could not perform heartbeat task - App registry not ready") logger.info("Could not perform heartbeat task - App registry not ready")
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
return return
threshold = timezone.now() - timedelta(minutes=30) threshold = timezone.now() - timedelta(minutes=30)
@ -150,7 +150,7 @@ def delete_successful_tasks():
try: try:
from django_q.models import Success from django_q.models import Success
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
logger.info("Could not perform 'delete_successful_tasks' - App registry not ready") logger.info("Could not perform 'delete_successful_tasks' - App registry not ready")
return return
@ -184,7 +184,7 @@ def delete_old_error_logs():
logger.info(f"Deleting {errors.count()} old error logs") logger.info(f"Deleting {errors.count()} old error logs")
errors.delete() errors.delete()
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
# Apps not yet loaded # Apps not yet loaded
logger.info("Could not perform 'delete_old_error_logs' - App registry not ready") logger.info("Could not perform 'delete_old_error_logs' - App registry not ready")
return return
@ -197,7 +197,7 @@ def check_for_updates():
try: try:
import common.models import common.models
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
# Apps not yet loaded! # Apps not yet loaded!
logger.info("Could not perform 'check_for_updates' - App registry not ready") logger.info("Could not perform 'check_for_updates' - App registry not ready")
return return
@ -244,7 +244,7 @@ def update_exchange_rates():
from InvenTree.exchange import InvenTreeExchange from InvenTree.exchange import InvenTreeExchange
from djmoney.contrib.exchange.models import ExchangeBackend, Rate from djmoney.contrib.exchange.models import ExchangeBackend, Rate
from common.settings import currency_code_default, currency_codes from common.settings import currency_code_default, currency_codes
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
# Apps not yet loaded! # Apps not yet loaded!
logger.info("Could not perform 'update_exchange_rates' - App registry not ready") logger.info("Could not perform 'update_exchange_rates' - App registry not ready")
return return

View File

@ -19,7 +19,7 @@ def delete_old_notifications():
try: try:
from common.models import NotificationEntry from common.models import NotificationEntry
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
logger.info("Could not perform 'delete_old_notifications' - App registry not ready") logger.info("Could not perform 'delete_old_notifications' - App registry not ready")
return return

View File

@ -153,7 +153,7 @@ def get_modules(pkg):
if not k.startswith('_') and (pkg_names is None or k in pkg_names): if not k.startswith('_') and (pkg_names is None or k in pkg_names):
context[k] = v context[k] = v
context[name] = module context[name] = module
except AppRegistryNotReady: except AppRegistryNotReady: # pragma: no cover
pass pass
except Exception as error: except Exception as error:
# this 'protects' against malformed plugin modules by more or less silently failing # this 'protects' against malformed plugin modules by more or less silently failing