summaryrefslogtreecommitdiff
path: root/python/subunit/tests
diff options
context:
space:
mode:
authorThomi Richards <thomi.richards@canonical.com>2013-11-25 10:50:33 +1300
committerThomi Richards <thomi.richards@canonical.com>2013-11-25 10:50:33 +1300
commitc4f8ec3a830b49316ae6edc3704f2a932e608625 (patch)
treefe31aa1991e19a96d626b594ac28430f8c0259a2 /python/subunit/tests
parent06531d31fe2428caaaf0509d39328787a43f0f44 (diff)
downloadsubunit-git-c4f8ec3a830b49316ae6edc3704f2a932e608625.tar.gz
Port code to use optparse, rather than argparse.
Diffstat (limited to 'python/subunit/tests')
-rw-r--r--python/subunit/tests/test_output_filter.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py
index 69e5b2a..ba96687 100644
--- a/python/subunit/tests/test_output_filter.py
+++ b/python/subunit/tests/test_output_filter.py
@@ -13,9 +13,7 @@
# license you chose for the specific language governing permissions and
# limitations under that license.
#
-
-
-import argparse
+import optparse
import datetime
from functools import partial
from io import BytesIO, StringIO
@@ -43,14 +41,14 @@ from subunit._output import (
import subunit._output as _o
-class SafeArgumentParser(argparse.ArgumentParser):
+class SafeOptionParser(optparse.OptionParser):
"""An ArgumentParser class that doesn't call sys.exit."""
def exit(self, status=0, message=""):
raise RuntimeError(message)
-safe_parse_arguments = partial(parse_arguments, ParserClass=SafeArgumentParser)
+safe_parse_arguments = partial(parse_arguments, ParserClass=SafeOptionParser)
class TestStatusArgParserTests(WithScenarios, TestCase):
@@ -128,9 +126,9 @@ class ArgParserTests(TestCase):
def setUp(self):
super(ArgParserTests, self).setUp()
- # prevent ARgumentParser from printing to stderr:
+ # prevent OptionParser from printing to stderr:
self._stderr = BytesIO()
- self.patch(argparse._sys, 'stderr', self._stderr)
+ self.patch(optparse.sys, 'stderr', self._stderr)
def test_can_parse_attach_file_without_test_id(self):
with NamedTemporaryFile() as tmp_file: