summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomi Richards <thomi.richards@canonical.com>2013-12-02 18:52:10 +1300
committerThomi Richards <thomi.richards@canonical.com>2013-12-02 18:52:10 +1300
commit59175ec6b495e330b709ea137f6dc7ce4caefb68 (patch)
tree591f11564c8ae42a9f538dab46b90c24e9adee24
parent51b0b53c3854f5bb1c2c024cc3176aaad87727df (diff)
downloadsubunit-59175ec6b495e330b709ea137f6dc7ce4caefb68.tar.gz
Fix failing tests.
-rw-r--r--python/subunit/_output.py6
-rw-r--r--python/subunit/tests/test_output_filter.py4
2 files changed, 5 insertions, 5 deletions
diff --git a/python/subunit/_output.py b/python/subunit/_output.py
index 0e9302b..af9dcad 100644
--- a/python/subunit/_output.py
+++ b/python/subunit/_output.py
@@ -132,7 +132,7 @@ def parse_arguments(args=None, ParserClass=OptionParser):
if not options.file_name:
options.file_name = 'stdin'
if sys.version[0] >= '3':
- options.attach_file = sys.stdin.buffer
+ options.attach_file = getattr(sys.stdin, 'buffer', sys.stdin)
else:
options.attach_file = sys.stdin
else:
@@ -150,10 +150,10 @@ def parse_arguments(args=None, ParserClass=OptionParser):
def set_status_cb(option, opt_str, value, parser, status_name):
if getattr(parser.values, "action", None) is not None:
- raise OptionValueError("argument %s: Only one status may be specified at once." % option)
+ raise OptionValueError("argument %s: Only one status may be specified at once." % opt_str)
if len(parser.rargs) == 0:
- raise OptionValueError("argument %s: must specify a single TEST_ID." % option)
+ raise OptionValueError("argument %s: must specify a single TEST_ID." % opt_str)
parser.values.action = status_name
parser.values.test_id = parser.rargs.pop(0)
diff --git a/python/subunit/tests/test_output_filter.py b/python/subunit/tests/test_output_filter.py
index c6caada..f53b37a 100644
--- a/python/subunit/tests/test_output_filter.py
+++ b/python/subunit/tests/test_output_filter.py
@@ -513,7 +513,7 @@ class FileDataTests(TestCase):
def test_files_have_timestamp(self):
_dummy_timestamp = datetime.datetime(2013, 1, 1, 0, 0, 0, 0, UTC)
- self.patch(_o, 'create_timestamp', lambda: self._dummy_timestamp)
+ self.patch(_o, 'create_timestamp', lambda: _dummy_timestamp)
with temp_file_contents(b"Hello") as f:
specified_file_name = self.getUniqueString()
@@ -525,7 +525,7 @@ class FileDataTests(TestCase):
self.assertThat(
result._events,
MatchesListwise([
- MatchesStatusCall(file_bytes=b'Hello', timestamp=self._dummy_timestamp),
+ MatchesStatusCall(file_bytes=b'Hello', timestamp=_dummy_timestamp),
])
)