From c7b0872cbe023f32e8fbd2c5774c19bc22320db2 Mon Sep 17 00:00:00 2001 From: Mathieu Mitchell Date: Fri, 19 Aug 2016 09:42:20 -0400 Subject: [PATCH] Introduce the virtualpdu entry point --- setup.cfg | 6 +++- virtualpdu/main.py | 4 +++ .../tests/integration/test_entrypoint.py | 30 +++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 virtualpdu/main.py create mode 100644 virtualpdu/tests/integration/test_entrypoint.py diff --git a/setup.cfg b/setup.cfg index a62c6e6..955b838 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,6 +23,10 @@ classifier = packages = virtualpdu +[entry_points] +console_scripts = + virtualpdu = virtualpdu.main:main + [build_sphinx] source-dir = doc/source build-dir = doc/build @@ -48,4 +52,4 @@ output_file = virtualpdu/locale/virtualpdu.pot [build_releasenotes] all_files = 1 build-dir = releasenotes/build -source-dir = releasenotes/source \ No newline at end of file +source-dir = releasenotes/source diff --git a/virtualpdu/main.py b/virtualpdu/main.py new file mode 100644 index 0000000..89c8c42 --- /dev/null +++ b/virtualpdu/main.py @@ -0,0 +1,4 @@ +def main(): + """VirtualPDU Entry Point""" + + print('VirtualPDU Entry Point') diff --git a/virtualpdu/tests/integration/test_entrypoint.py b/virtualpdu/tests/integration/test_entrypoint.py new file mode 100644 index 0000000..502c344 --- /dev/null +++ b/virtualpdu/tests/integration/test_entrypoint.py @@ -0,0 +1,30 @@ +# Copyright 2016 Internap +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +import subprocess + +import sys + +import os +from virtualpdu.tests import base + + +class TestEntrypointIntegration(base.TestCase): + def test_entry_point_works(self): + self.assertEqual( + subprocess.check_output([ + sys.executable, self._get_entrypoint_path('virtualpdu')]), + b'VirtualPDU Entry Point\n') + + def _get_entrypoint_path(self, entrypoint): + return os.path.join(os.path.dirname(sys.executable), entrypoint)