summaryrefslogtreecommitdiffstats
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/Testsrc/Testlib/TestOptions/TestOptions.py7
-rw-r--r--testsuite/common.py4
2 files changed, 9 insertions, 2 deletions
diff --git a/testsuite/Testsrc/Testlib/TestOptions/TestOptions.py b/testsuite/Testsrc/Testlib/TestOptions/TestOptions.py
index a2dc8ffe2..034a4580a 100644
--- a/testsuite/Testsrc/Testlib/TestOptions/TestOptions.py
+++ b/testsuite/Testsrc/Testlib/TestOptions/TestOptions.py
@@ -185,6 +185,13 @@ class TestBasicOptions(OptionTestCase):
options = self._test_options(env={"TEST_PATH_OPTION": "/foo"})
self.assertEqual(options.test_path_option, "/foo")
+ def test_version(self):
+ """print version and exit on --version"""
+ self.assertRaises(
+ SystemExit,
+ self._test_options,
+ options=['--version'])
+
def test_set_boolean_in_cli(self):
"""set boolean options in CLI options."""
# passing the option yields the reverse of the default, no
diff --git a/testsuite/common.py b/testsuite/common.py
index a86e9c5d9..4b29e5f52 100644
--- a/testsuite/common.py
+++ b/testsuite/common.py
@@ -16,9 +16,9 @@ import lxml.etree
import Bcfg2.Options
from mock import patch, MagicMock, _patch, DEFAULT
try:
- from unittest import skip, skipIf, skipUnless, TestCase
-except ImportError:
from unittest2 import skip, skipIf, skipUnless, TestCase
+except ImportError:
+ from unittest import skip, skipIf, skipUnless, TestCase
#: The XInclude namespace name
XI_NAMESPACE = "http://www.w3.org/2001/XInclude"