feat: publish dbussmsforward refactor
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
PROJECT_ROOT = Path("/Users/chick/.Hermes/workspace/DbusSmsForward")
|
||||
CLI_ENV = {**(__import__("os").environ), "PYTHONPATH": str(PROJECT_ROOT / "src")}
|
||||
|
||||
|
||||
class PackagingTests(unittest.TestCase):
|
||||
def test_editable_install_exposes_dbussmsforward_command(self):
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
venv_dir = Path(tmpdir) / "venv"
|
||||
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)
|
||||
python_bin = venv_dir / "bin" / "python"
|
||||
pip_bin = venv_dir / "bin" / "pip"
|
||||
|
||||
subprocess.run([str(python_bin), "-m", "pip", "install", "--upgrade", "pip"], check=True)
|
||||
subprocess.run([str(pip_bin), "install", "-e", str(PROJECT_ROOT)], check=True)
|
||||
|
||||
result = subprocess.run(
|
||||
[str(venv_dir / "bin" / "dbussmsforward"), "validate-config", "--config", "appsettings.python.json"],
|
||||
cwd=str(PROJECT_ROOT),
|
||||
env=CLI_ENV,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
check=False,
|
||||
)
|
||||
|
||||
self.assertEqual(result.returncode, 0, msg=result.stderr)
|
||||
self.assertIn("config ok", result.stdout)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user