mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-31 17:28:07 +00:00
Add --keep option to setup-test task (#12308)
Allow keeping existing data
This commit is contained in:
@@ -1840,6 +1840,7 @@ def test(
|
|||||||
@task(
|
@task(
|
||||||
help={
|
help={
|
||||||
'dev': 'Set up development environment at the end',
|
'dev': 'Set up development environment at the end',
|
||||||
|
'keep': 'Keep existing demo dataset (do not re-clone)',
|
||||||
'validate_files': 'Validate media files are correctly copied',
|
'validate_files': 'Validate media files are correctly copied',
|
||||||
'use_ssh': 'Use SSH protocol for cloning the demo dataset (requires SSH key)',
|
'use_ssh': 'Use SSH protocol for cloning the demo dataset (requires SSH key)',
|
||||||
'branch': 'Specify branch of demo-dataset to clone (default = main)',
|
'branch': 'Specify branch of demo-dataset to clone (default = main)',
|
||||||
@@ -1848,12 +1849,13 @@ def test(
|
|||||||
)
|
)
|
||||||
def setup_test(
|
def setup_test(
|
||||||
c,
|
c,
|
||||||
ignore_update=False,
|
ignore_update: bool = False,
|
||||||
dev=False,
|
dev: bool = False,
|
||||||
validate_files=False,
|
keep: bool = False,
|
||||||
use_ssh=False,
|
validate_files: bool = False,
|
||||||
verbose=False,
|
use_ssh: bool = False,
|
||||||
path='inventree-demo-dataset',
|
verbose: bool = False,
|
||||||
|
path: str = 'inventree-demo-dataset',
|
||||||
branch='main',
|
branch='main',
|
||||||
):
|
):
|
||||||
"""Setup a testing environment."""
|
"""Setup a testing environment."""
|
||||||
@@ -1866,6 +1868,7 @@ def setup_test(
|
|||||||
|
|
||||||
template_dir = local_dir().joinpath(path)
|
template_dir = local_dir().joinpath(path)
|
||||||
|
|
||||||
|
if not keep:
|
||||||
# Remove old data directory
|
# Remove old data directory
|
||||||
if template_dir.exists():
|
if template_dir.exists():
|
||||||
run(c, f'rm {template_dir} -r')
|
run(c, f'rm {template_dir} -r')
|
||||||
|
|||||||
Reference in New Issue
Block a user