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
|
run: cmdeploy fmt -v
|
||||||
|
|
||||||
- name: run deploy-chatmail offline tests
|
- name: run deploy-chatmail offline tests
|
||||||
run: pytest tests
|
run: pytest --pyargs cmdeploy
|
||||||
|
|
||||||
- name: initialize with chatmail domain
|
- name: initialize with chatmail domain
|
||||||
run: cmdeploy init chat.example.org
|
run: cmdeploy init chat.example.org
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ requires = ["setuptools>=68"]
|
|||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "deploy-chatmail"
|
name = "cmdeploy"
|
||||||
version = "0.1"
|
version = "0.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"pyinfra",
|
"pyinfra",
|
||||||
"pillow",
|
"pillow",
|
||||||
@@ -26,6 +26,7 @@ cmdeploy = "cmdeploy.cmdeploy:main"
|
|||||||
|
|
||||||
[project.entry-points.pytest11]
|
[project.entry-points.pytest11]
|
||||||
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
"chatmaild.testplugin" = "chatmaild.tests.plugin"
|
||||||
|
"cmdeploy.testplugin" = "cmdeploy.tests.plugin"
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
addopts = "-v -ra --strict-markers"
|
addopts = "-v -ra --strict-markers"
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ def test_cmd(args, out):
|
|||||||
|
|
||||||
pytest_path = shutil.which("pytest")
|
pytest_path = shutil.which("pytest")
|
||||||
ret = out.run_ret(
|
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
|
return ret
|
||||||
|
|
||||||
@@ -147,11 +147,7 @@ def fmt_cmd_options(parser):
|
|||||||
def fmt_cmd(args, out):
|
def fmt_cmd(args, out):
|
||||||
"""Run formattting fixes (fuff and black) on all chatmail source code."""
|
"""Run formattting fixes (fuff and black) on all chatmail source code."""
|
||||||
|
|
||||||
chatmaild = importlib.resources.files("chatmaild")
|
sources = [str(importlib.resources.files(x)) for x in ("chatmaild", "cmdeploy")]
|
||||||
cmdeploy = importlib.resources.files("cmdeploy")
|
|
||||||
tests = cmdeploy.joinpath("../../../tests")
|
|
||||||
sources = list(str(x) for x in [chatmaild, cmdeploy, tests])
|
|
||||||
|
|
||||||
black_args = [shutil.which("black")]
|
black_args = [shutil.which("black")]
|
||||||
ruff_args = [shutil.which("ruff")]
|
ruff_args = [shutil.which("ruff")]
|
||||||
|
|
||||||
@@ -174,9 +170,10 @@ def fmt_cmd(args, out):
|
|||||||
|
|
||||||
def bench_cmd(args, out):
|
def bench_cmd(args, out):
|
||||||
"""Run benchmarks against an online chatmail instance."""
|
"""Run benchmarks against an online chatmail instance."""
|
||||||
pytest_path = shutil.which("pytest")
|
args = ["pytest", "--pyargs", "cmdeploy.tests.online.benchmark", "-vrx"]
|
||||||
benchmark = "tests/online/benchmark.py"
|
cmdstring = " ".join(args)
|
||||||
subprocess.check_call([pytest_path, benchmark, "-vrx"])
|
out.green(f"[$ {cmdstring}]")
|
||||||
|
subprocess.check_call(args)
|
||||||
|
|
||||||
|
|
||||||
def webdev_cmd(args, out):
|
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
|
@pytest.fixture
|
||||||
def chatmail_config(pytestconfig):
|
def chatmail_config(pytestconfig):
|
||||||
current = basedir = Path()
|
current = basedir = Path().resolve()
|
||||||
while 1:
|
while 1:
|
||||||
path = current.joinpath("chatmail.ini").resolve()
|
path = current.joinpath("chatmail.ini").resolve()
|
||||||
if path.exists():
|
if path.exists():
|
||||||
Reference in New Issue
Block a user