mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-12 10:05:39 +00:00
Update demo data hook to copy media files (#3441)
* Simplify settings.py / config.py - get_setting function has been streamlined - move some functions into config.py * Spelling fix: IGNORRED is IGNORED * Ensure yaml is installed as part of docker image - invoke path is still mucking us around * Fix broken migration * Copy media files from demo dataset when installing test data * Cleanup settings.py * Fix for configuration file traversal * Line fix * Update quickstart guide for docker * Allow plugin file and plugin dir to be specified in configuration file * Cleanup config template file * Allow secret_key information to be provided in configuration file * Adjust root paths for CI tests * resolve paths * Revert paths for CI step * remove dead code * Revert configuration variables to old names - Prevent breaking changes * Simplify secret key generation * Fix default timeout for background worker process * Revert change for customization options
This commit is contained in:
13
tasks.py
13
tasks.py
@ -4,6 +4,7 @@ import json
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
@ -522,6 +523,8 @@ def test(c, database=None):
|
||||
def setup_test(c, ignore_update=False, dev=False, path="inventree-demo-dataset"):
|
||||
"""Setup a testing enviroment."""
|
||||
|
||||
from InvenTree.InvenTree.config import get_media_dir
|
||||
|
||||
if not ignore_update:
|
||||
update(c)
|
||||
|
||||
@ -540,8 +543,16 @@ def setup_test(c, ignore_update=False, dev=False, path="inventree-demo-dataset")
|
||||
migrate(c)
|
||||
|
||||
# Load data
|
||||
print("Loading data ...")
|
||||
print("Loading database records ...")
|
||||
import_records(c, filename=f'{path}/inventree_data.json', clear=True)
|
||||
|
||||
# Copy media files
|
||||
print("Copying media files ...")
|
||||
src = Path(path).joinpath('media').resolve()
|
||||
dst = get_media_dir()
|
||||
|
||||
shutil.copytree(src, dst, dirs_exist_ok=True)
|
||||
|
||||
print("Done setting up test enviroment...")
|
||||
print("========================================")
|
||||
|
||||
|
Reference in New Issue
Block a user