From 0eb7dbe09fb06f4f14e4a3ff766a776126a0c200 Mon Sep 17 00:00:00 2001 From: Thomi Richards Date: Mon, 25 Nov 2013 10:50:33 +1300 Subject: Port code to use optparse, rather than argparse. --- python/subunit/tests/test_output_filter.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'python/subunit/tests') 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: -- cgit v1.2.1