From 0193198215e51f092222965c2119a4d125f867df Mon Sep 17 00:00:00 2001
From: Mohammed Naser <mnaser@vexxhost.com>
Date: Mon, 23 Sep 2019 09:46:01 -0400
Subject: [PATCH] Add unit tests for tox_instalL_sibling_packages

This adds very basic framework and a simple unit test for a function
which had non-Python 3 code.

Change-Id: Ie22402aeacd21942c356d7d7c5c962b40a29caa4
---
 .../test_tox_install_sibling_packages.py      | 37 +++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 roles/tox/library/test_tox_install_sibling_packages.py

diff --git a/roles/tox/library/test_tox_install_sibling_packages.py b/roles/tox/library/test_tox_install_sibling_packages.py
new file mode 100644
index 000000000..6b145c28a
--- /dev/null
+++ b/roles/tox/library/test_tox_install_sibling_packages.py
@@ -0,0 +1,37 @@
+# Copyright (C) 2019 VEXXHOST, Inc.
+#
+# 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.
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import sys
+import testtools
+
+from .tox_install_sibling_packages import get_installed_packages
+
+
+class TestToxInstallSiblingPackages(testtools.TestCase):
+    def test_get_installed_packages(self):
+        # NOTE(mnaser): Given that we run our tests inside Tox, we can
+        #               leverage the tox virtual environment we use in
+        #               unit tests instead of mocking up everything.
+        pkgs = get_installed_packages(sys.executable)
+
+        # NOTE(mnaser): Zuul should be installed in this virtualenv
+        #               but this might fail later if we stop adding Zuul
+        #               in the unit tests.
+        self.assertIn("zuul", pkgs)