fix cmdeploy test command
This commit is contained in:
parent
d70eb78a76
commit
cdbda291c5
9
.github/workflows/ci.yaml
vendored
9
.github/workflows/ci.yaml
vendored
@ -24,15 +24,18 @@ jobs:
|
|||||||
- name: initenv
|
- name: initenv
|
||||||
run: scripts/initenv.sh
|
run: scripts/initenv.sh
|
||||||
|
|
||||||
|
- name: append venv/bin to PATH
|
||||||
|
run: echo venv/bin >>$GITHUB_PATH
|
||||||
|
|
||||||
- name: run formatting checks
|
- name: run formatting checks
|
||||||
run: venv/bin/cmdeploy fmt -v
|
run: cmdeploy fmt -v
|
||||||
|
|
||||||
- name: run deploy-chatmail offline tests
|
- name: run deploy-chatmail offline tests
|
||||||
working-directory: deploy-chatmail
|
working-directory: deploy-chatmail
|
||||||
run: venv/bin/pytest tests
|
run: pytest tests
|
||||||
|
|
||||||
- name: initialize with chatmail domain
|
- name: initialize with chatmail domain
|
||||||
run: venv/bin/cmdeploy init chat.example.org
|
run: cmdeploy init chat.example.org
|
||||||
|
|
||||||
# all other cmdeploy commands require a staging server
|
# all other cmdeploy commands require a staging server
|
||||||
# see https://github.com/deltachat/chatmail/issues/100
|
# see https://github.com/deltachat/chatmail/issues/100
|
||||||
|
@ -15,6 +15,10 @@ dependencies = [
|
|||||||
"termcolor",
|
"termcolor",
|
||||||
"build",
|
"build",
|
||||||
"tox",
|
"tox",
|
||||||
|
"ruff",
|
||||||
|
"black",
|
||||||
|
"pytest",
|
||||||
|
"pytest-xdist",
|
||||||
]
|
]
|
||||||
|
|
||||||
[project.scripts]
|
[project.scripts]
|
||||||
|
@ -111,26 +111,20 @@ def status_cmd(args, out):
|
|||||||
|
|
||||||
|
|
||||||
def test_cmd(args, out):
|
def test_cmd(args, out):
|
||||||
"""Run local and online tests.
|
"""Run local and online tests for chatmail deployment.
|
||||||
|
|
||||||
This will also pip-install 'deltachat' if it's not available.
|
This will automatically pip-install 'deltachat' if it's not available.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
tox = shutil.which("tox")
|
|
||||||
proc1 = subprocess.run([tox, "-c", "chatmaild"])
|
|
||||||
proc2 = subprocess.run([tox, "-c", "deploy-chatmail"])
|
|
||||||
|
|
||||||
x = importlib.util.find_spec("deltachat")
|
x = importlib.util.find_spec("deltachat")
|
||||||
if x is None:
|
if x is None:
|
||||||
out.check_call(f"{sys.executable} -m pip install deltachat")
|
out.check_call(f"{sys.executable} -m pip install deltachat")
|
||||||
|
|
||||||
pytest_path = shutil.which("pytest")
|
pytest_path = shutil.which("pytest")
|
||||||
proc3 = subprocess.run(
|
ret = out.run_ret(
|
||||||
[pytest_path, "tests/", "-rs", "-x", "-vrx", "--durations=5"]
|
[pytest_path, "tests/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
|
||||||
)
|
)
|
||||||
if any(x.returncode != 0 for x in (proc1, proc2, proc3)):
|
return ret
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def fmt_cmd_options(parser):
|
def fmt_cmd_options(parser):
|
||||||
@ -219,6 +213,13 @@ class Out:
|
|||||||
self(f"[$ {arg}]", file=sys.stderr)
|
self(f"[$ {arg}]", file=sys.stderr)
|
||||||
return subprocess.check_call(arg, shell=True, env=env)
|
return subprocess.check_call(arg, shell=True, env=env)
|
||||||
|
|
||||||
|
def run_ret(self, args, env=None, quiet=False):
|
||||||
|
if not quiet:
|
||||||
|
cmdstring = " ".join(args)
|
||||||
|
self(f"[$ {cmdstring}]", file=sys.stderr)
|
||||||
|
proc = subprocess.run(args, env=env)
|
||||||
|
return proc.returncode
|
||||||
|
|
||||||
|
|
||||||
def add_config_option(parser):
|
def add_config_option(parser):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
Loading…
Reference in New Issue
Block a user