mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add test command (#3372)
* integrate test loading as task - use with gitpod * ignore test data with git
This commit is contained in:
parent
09987ad79b
commit
864d69d968
1
.gitignore
vendored
1
.gitignore
vendored
@ -48,6 +48,7 @@ docs/_build
|
||||
inventree_media
|
||||
inventree_static
|
||||
static_i18n
|
||||
inventree-data
|
||||
|
||||
# Local config file
|
||||
config.yaml
|
||||
|
16
.gitpod.yml
16
.gitpod.yml
@ -10,29 +10,21 @@ tasks:
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip install invoke
|
||||
inv install
|
||||
mkdir dev
|
||||
inv update
|
||||
gp sync-done setup_server
|
||||
inv test-setup
|
||||
gp sync-done start_server
|
||||
|
||||
- name: Start server
|
||||
init: gp sync-await setup_server
|
||||
init: gp sync-await start_server
|
||||
command: |
|
||||
gp sync-await setup_server
|
||||
gp sync-await start_server
|
||||
export INVENTREE_DB_ENGINE='sqlite3'
|
||||
export INVENTREE_DB_NAME='/workspace/InvenTree/dev/database.sqlite3'
|
||||
export INVENTREE_MEDIA_ROOT='/workspace/InvenTree/inventree-data/media'
|
||||
export INVENTREE_STATIC_ROOT='/workspace/InvenTree/dev/static'
|
||||
|
||||
source venv/bin/activate
|
||||
rm /workspace/InvenTree/inventree-data -r
|
||||
git clone https://github.com/inventree/demo-dataset /workspace/InvenTree/inventree-data
|
||||
invoke delete-data -f
|
||||
invoke import-records -f /workspace/InvenTree/inventree-data/inventree_data.json
|
||||
|
||||
inv server
|
||||
|
||||
# List the ports to expose. Learn more https://www.gitpod.io/docs/config-ports/
|
||||
ports:
|
||||
- port: 8000
|
||||
onOpen: open-preview
|
||||
|
13
tasks.py
13
tasks.py
@ -511,6 +511,19 @@ def test(c, database=None):
|
||||
manage(c, 'test', pty=True)
|
||||
|
||||
|
||||
@task(pre=[update])
|
||||
def setup_test(c):
|
||||
"""Setup a testing enviroment."""
|
||||
# Remove old data directory
|
||||
c.run('rm inventree-data -r')
|
||||
|
||||
# Get test data
|
||||
c.run('git clone https://github.com/inventree/demo-dataset inventree-data')
|
||||
|
||||
# Load data
|
||||
import_records(c, filename='inventree-data/inventree_data.json', clear=True)
|
||||
|
||||
|
||||
@task
|
||||
def coverage(c):
|
||||
"""Run code-coverage of the InvenTree codebase, using the 'coverage' code-analysis tools.
|
||||
|
Loading…
Reference in New Issue
Block a user