mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-23 08:13:14 +00:00
Add NO_CLI env var for tests (#1856)
This commit is contained in:
parent
c501098982
commit
6515c42f26
1 changed files with 26 additions and 25 deletions
|
@ -5,11 +5,11 @@ import argparse
|
|||
|
||||
from distutils.util import strtobool
|
||||
|
||||
no_update = bool(os.environ.get("NO_UPDATE", False))
|
||||
no_update = os.environ.get("NO_UPDATE", "false").strip() == "true"
|
||||
no_cli = os.environ.get("NO_CLI", "false").strip() == "true"
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
|
||||
def get_args():
|
||||
parser.register('type', bool, strtobool)
|
||||
|
||||
config_dir = os.path.realpath(os.path.join(os.path.dirname(os.path.dirname(__file__)), '..', 'data'))
|
||||
|
@ -29,9 +29,10 @@ def get_args():
|
|||
parser.add_argument('--no-tasks', default=False, type=bool, const=True, metavar="BOOL", nargs="?",
|
||||
help="Disable all tasks (default: False)")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
args = get_args()
|
||||
if not no_cli:
|
||||
args = parser.parse_args()
|
||||
if no_update:
|
||||
args.no_update = True
|
||||
else:
|
||||
args = parser.parse_args(["-c", config_dir, "--no-update"])
|
||||
|
|
Loading…
Reference in a new issue