move tests into cmdeploy

This commit is contained in:
holger krekel
2023-12-11 17:36:18 +01:00
committed by missytake
parent d6df0f0604
commit 8e6869d8e3
14 changed files with 11 additions and 13 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",
@@ -26,6 +26,7 @@ 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

@@ -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")
cmdeploy = importlib.resources.files("cmdeploy")
tests = cmdeploy.joinpath("../../../tests")
sources = list(str(x) for x in [chatmaild, cmdeploy, 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

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():