Axel Andersson 816553f1bc Added powertrain-build entrypoint
The entrypoint will make it easier to install powertrain-build to an
isolated venv without having to call python -m powertrain_build.

Change-Id: I3850c97d17707f9bc03640bd1d997508637d97ba
2024-10-30 10:33:42 +01:00

25 lines
979 B
Python

import sys
from subprocess import run
from unittest import TestCase
class TestCli(TestCase):
"""Test the cli module."""
def test_entry_points(self):
"""Tests that entrypoints are correctly defined and work both as __main__ and sub-commands."""
modules = [
"powertrain_build.wrapper",
"powertrain_build.interface.generate_adapters",
"powertrain_build.interface.generate_hi_interface",
"powertrain_build.interface.generate_service",
"powertrain_build.interface.generate_wrappers",
"powertrain_build.interface.model_yaml_verification",
"powertrain_build.interface.update_model_yaml",
"powertrain_build.interface.update_call_sources",
]
for module in modules:
entrypoint = module.replace("_", "-").split(".")
run(entrypoint + ["--help"], check=True)
run([sys.executable, "-m", module, "--help"], check=True)