diff --git a/dpdata/__main__.py b/dpdata/__main__.py new file mode 100644 index 00000000..aad1556f --- /dev/null +++ b/dpdata/__main__.py @@ -0,0 +1,4 @@ +from dpdata.cli import dpdata_cli + +if __name__ == "__main__": + dpdata_cli() diff --git a/tests/test_cli.py b/tests/test_cli.py index 423b8896..200a1c1e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,5 @@ import subprocess as sp +import sys import unittest from context import dpdata @@ -26,3 +27,12 @@ def setUpClass(cls) -> None: @classmethod def tearDownClass(cls) -> None: cls.system = None + + +class TestClassScript(unittest.TestCase): + def test_class_script(self): + expected_version = dpdata.__version__ + output = sp.check_output([sys.executable, "-m", "dpdata", "--version"]).decode( + "ascii" + ) + assert output.splitlines()[0] == f"dpdata v{expected_version}"