Append correct python path if not present (only during testing) (#4048)

* Append correct python path if not present (only during testing)

* Add a bunch more debug info
This commit is contained in:
Oliver 2022-12-12 19:17:16 +11:00 committed by GitHub
parent d95416c559
commit 2f7be70287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -21,6 +21,10 @@ on:
branches:
- 'master'
pull_request:
branches:
- 'master'
jobs:
# Build the docker image

View File

@ -59,6 +59,13 @@ def get_config_file(create=True) -> Path:
def load_config_data() -> map:
"""Load configuration data from the config file."""
import sys
print("load_config_data()")
print("- cwd:", os.getcwd())
print("- exe:", sys.executable)
print("- path:", sys.path)
import yaml
cfg_file = get_config_file()

View File

@ -31,6 +31,16 @@ INVENTREE_NEWS_URL = 'https://inventree.org/news/feed.atom'
# Determine if we are running in "test" mode e.g. "manage.py test"
TESTING = 'test' in sys.argv
# Note: The following fix is "required" for docker build workflow
# Note: 2022-12-12 still unsure why...
if TESTING:
# Ensure that sys.path includes global python libs
python_dir = os.path.dirname(sys.executable)
python_lib = os.path.join(python_dir, "lib", "site-packages")
if python_lib not in sys.path:
sys.path.append(python_lib)
# Are environment variables manipulated by tests? Needs to be set by testing code
TESTING_ENV = False