mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
move tests into cmdeploy
This commit is contained in:
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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):
|
||||
|
||||
0
cmdeploy/src/cmdeploy/tests/__init__.py
Normal file
0
cmdeploy/src/cmdeploy/tests/__init__.py
Normal file
0
cmdeploy/src/cmdeploy/tests/online/__init__.py
Normal file
0
cmdeploy/src/cmdeploy/tests/online/__init__.py
Normal 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():
|
||||
Reference in New Issue
Block a user