Compare commits

...

2 Commits

Author SHA1 Message Date
holger krekel
04e3a4eef7 move tests into cmdeploy 2023-12-11 17:59:01 +01:00
holger krekel
cf6ed68a12 rename deploy_chatmail to cmdeploy 2023-12-11 17:59:01 +01:00
41 changed files with 20 additions and 22 deletions

View File

@@ -31,7 +31,7 @@ jobs:
run: cmdeploy fmt -v
- name: run deploy-chatmail offline tests
run: pytest tests
run: pytest --pyargs cmdeploy
- name: initialize with chatmail domain
run: cmdeploy init chat.example.org

View File

@@ -3,8 +3,8 @@ requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "deploy-chatmail"
version = "0.1"
name = "cmdeploy"
version = "0.2"
dependencies = [
"pyinfra",
"pillow",
@@ -22,10 +22,11 @@ dependencies = [
]
[project.scripts]
cmdeploy = "deploy_chatmail.cmdeploy:main"
cmdeploy = "cmdeploy.cmdeploy:main"
[project.entry-points.pytest11]
"chatmaild.testplugin" = "chatmaild.tests.plugin"
"cmdeploy.testplugin" = "cmdeploy.tests.plugin"
[tool.pytest.ini_options]
addopts = "-v -ra --strict-markers"

View File

@@ -53,9 +53,9 @@ def run_cmd(args, out):
env = os.environ.copy()
env["CHATMAIL_DOMAIN"] = args.config.mail_domain
deploypy = "deploy-chatmail/src/deploy_chatmail/deploy.py"
deploy_path = "cmdeploy/src/cmdeploy/deploy.py"
pyinf = "pyinfra --dry" if args.dry_run else "pyinfra"
cmd = f"{pyinf} --ssh-user root {args.config.mail_domain} {deploypy}"
cmd = f"{pyinf} --ssh-user root {args.config.mail_domain} {deploy_path}"
out.check_call(cmd, env=env)
@@ -122,7 +122,7 @@ def test_cmd(args, out):
pytest_path = shutil.which("pytest")
ret = out.run_ret(
[pytest_path, "tests/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
[pytest_path, "cmdeploy/src/", "-n4", "-rs", "-x", "-vrx", "--durations=5"]
)
return ret
@@ -147,11 +147,7 @@ def fmt_cmd_options(parser):
def fmt_cmd(args, out):
"""Run formattting fixes (fuff and black) on all chatmail source code."""
chatmaild = importlib.resources.files("chatmaild")
deploy_chatmail = importlib.resources.files("deploy_chatmail")
tests = deploy_chatmail.joinpath("../../../tests")
sources = list(str(x) for x in [chatmaild, deploy_chatmail, tests])
sources = [str(importlib.resources.files(x)) for x in ("chatmaild", "cmdeploy")]
black_args = [shutil.which("black")]
ruff_args = [shutil.which("ruff")]
@@ -174,9 +170,10 @@ def fmt_cmd(args, out):
def bench_cmd(args, out):
"""Run benchmarks against an online chatmail instance."""
pytest_path = shutil.which("pytest")
benchmark = "tests/online/benchmark.py"
subprocess.check_call([pytest_path, benchmark, "-vrx"])
args = ["pytest", "--pyargs", "cmdeploy.tests.online.benchmark", "-vrx"]
cmdstring = " ".join(args)
out.green(f"[$ {cmdstring}]")
subprocess.check_call(args)
def webdev_cmd(args, out):

View File

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -1,6 +1,6 @@
import os
import pyinfra
from deploy_chatmail import deploy_chatmail
from cmdeploy import deploy_chatmail
def main():

View File

View File

@@ -1,4 +1,4 @@
from deploy_chatmail.genqr import gen_qr_png_data
from cmdeploy.genqr import gen_qr_png_data
def test_gen_qr_png_data(maildomain):

View File

@@ -38,7 +38,7 @@ def pytest_runtest_setup(item):
@pytest.fixture
def chatmail_config(pytestconfig):
current = basedir = Path()
current = basedir = Path().resolve()
while 1:
path = current.joinpath("chatmail.ini").resolve()
if path.exists():

View File

@@ -1,7 +1,7 @@
import os
import pytest
from deploy_chatmail.cmdeploy import get_parser, main
from cmdeploy.cmdeploy import get_parser, main
from chatmaild.config import read_config

View File

@@ -1,10 +1,10 @@
import importlib.resources
from deploy_chatmail.www import build_webpages
from cmdeploy.www import build_webpages
def test_build_webpages(tmp_path, make_config):
pkgroot = importlib.resources.files("deploy_chatmail")
pkgroot = importlib.resources.files("cmdeploy")
src_dir = pkgroot.joinpath("../../../www/src").resolve()
assert src_dir.exists(), src_dir
config = make_config("chat.example.org")

View File

@@ -2,8 +2,8 @@
set -e
python3 -m venv venv
venv/bin/pip install -e deploy-chatmail
venv/bin/pip install -e chatmaild
venv/bin/pip install -e cmdeploy
source venv/bin/activate
echo activated 'venv' python virtualenv environment containing "cmdeploy" tool