Fix failing tests.
authorThomi Richards <thomi.richards@canonical.com>
Mon, 2 Dec 2013 05:52:10 +0000 (18:52 +1300)
committerThomi Richards <thomi.richards@canonical.com>
Mon, 2 Dec 2013 05:52:10 +0000 (18:52 +1300)
python/subunit/_output.py
python/subunit/tests/test_output_filter.py

index 0e9302b442b5a349963f8bfa9c0bfcc6f04d8706..af9dcada53ff9b24d564034436d16245e6a16ff3 100644 (file)
@@ -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)
 
index c6caada8912699b8a8bcb24bfc7245e6b6ffde80..f53b37a71894387c08f514030f653c05fd5737a6 100644 (file)
@@ -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),
                 ])
             )