mirror of
https://github.com/inventree/InvenTree.git
synced 2026-08-30 16:58:06 +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(
|
||||
help={
|
||||
'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',
|
||||
'use_ssh': 'Use SSH protocol for cloning the demo dataset (requires SSH key)',
|
||||
'branch': 'Specify branch of demo-dataset to clone (default = main)',
|
||||
@@ -1848,12 +1849,13 @@ def test(
|
||||
)
|
||||
def setup_test(
|
||||
c,
|
||||
ignore_update=False,
|
||||
dev=False,
|
||||
validate_files=False,
|
||||
use_ssh=False,
|
||||
verbose=False,
|
||||
path='inventree-demo-dataset',
|
||||
ignore_update: bool = False,
|
||||
dev: bool = False,
|
||||
keep: bool = False,
|
||||
validate_files: bool = False,
|
||||
use_ssh: bool = False,
|
||||
verbose: bool = False,
|
||||
path: str = 'inventree-demo-dataset',
|
||||
branch='main',
|
||||
):
|
||||
"""Setup a testing environment."""
|
||||
@@ -1866,6 +1868,7 @@ def setup_test(
|
||||
|
||||
template_dir = local_dir().joinpath(path)
|
||||
|
||||
if not keep:
|
||||
# Remove old data directory
|
||||
if template_dir.exists():
|
||||
run(c, f'rm {template_dir} -r')
|
||||
|
||||
Reference in New Issue
Block a user