From 937c237d98bf59495ba585af274bbeda335f0fa3 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 23 May 2026 05:49:44 +0000 Subject: [PATCH] Fix isInTestMode check --- src/backend/InvenTree/InvenTree/api_version.py | 2 +- src/backend/InvenTree/InvenTree/ready.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/backend/InvenTree/InvenTree/api_version.py b/src/backend/InvenTree/InvenTree/api_version.py index e4ffbc0b53..a8192a2431 100644 --- a/src/backend/InvenTree/InvenTree/api_version.py +++ b/src/backend/InvenTree/InvenTree/api_version.py @@ -20,7 +20,7 @@ v491 -> 2026-05-21 : https://github.com/inventree/InvenTree/pull/11979 - Add API serializer for deleting a stock location v490 -> 2026-05-19 : https://github.com/inventree/InvenTree/pull/11963 - - moves user-self-filtered endpoints to /user/me/ to make their security boundaries clearer + - Moves user-self-filtered endpoints to /user/me/ to make their security boundaries clearer v489 -> 2026-05-18 : https://github.com/inventree/InvenTree/pull/11962 - Removes the "remote_image" field from the Part API endpoint diff --git a/src/backend/InvenTree/InvenTree/ready.py b/src/backend/InvenTree/InvenTree/ready.py index 35c1130b15..8007e30a81 100644 --- a/src/backend/InvenTree/InvenTree/ready.py +++ b/src/backend/InvenTree/InvenTree/ready.py @@ -37,7 +37,9 @@ def isAppLoaded(app_name: str) -> bool: def isInTestMode(): """Returns True if the database is in testing mode.""" - return any(x in sys.argv for x in ['test', 'pytest']) + return any(x in sys.argv for x in ['test', 'pytest']) or sys.argv[0].endswith( + 'pytest' + ) def isWaitingForDatabase():