The traceback I get is:
Traceback (most recent call last):
File "<ipython-input-5-0e0da22da8b3>", line 6, in <module>
suite1.run(test_result)
File "/usr/lib/python2.7/unittest/suite.py", line 108, in run
test(result)
File "/usr/lib/python2.7/unittest/case.py", line 391, in __call__
return self.run(*args, **kwds)
File "/usr/lib/python2.7/unittest/case.py", line 331, in run
result.addFailure(self, sys.exc_info())
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/subunit/__init__.py", line 668, in addFailure
self._addOutcome("failure", test, error=error, details=details)
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/subunit/__init__.py", line 697, in _addOutcome
tb_content = TracebackContent(error, test)
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/testtools/content.py", line 142, in __init__
value = self._exc_info_to_unicode(err, test)
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/testtools/content.py", line 169, in _exc_info_to_unicode
msgLines = format_exception(exctype, value, tb, length)
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/testtools/compat.py", line 352, in _format_exc_info
if evalue is None:
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/testtools/compat.py", line 289, in _get_source_encoding
newtuple = _EncodingTuple(linecache.cache[filename])
File "/home/drakeol/virtualenvs/dvvtools/local/lib/python2.7/site-packages/testtools/compat.py", line 261, in _detect_encoding
# Source starting with UTF-8 BOM is either UTF-8 or a SyntaxError
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
When I run the same code in a normal python file (utf-8 encoding) it runs fine and I see subunit output on stdout:
$ python subunitscratch.py
test: __main__.MyTest.test_one
successful: __main__.MyTest.test_one
test: __main__.MyTest.test_two
failure: __main__.MyTest.test_two [
Traceback (most recent call last):
File "subunitscratch.py", line 8, in test_two
assert False, "two failed..."
AssertionError: two failed...
]
I'm guessing it's to do with the fact that running in ipython notebook means there's no encoding for the source file of a traceback...
Python 2.7.3
testrepository==0.0.8
testtools==0.9.22
nose-subunit==0.2
python-subunit==0.0.8
Aside: when I run the same code in the vanilla interpreter it runs ok but the traceback is less informative as there's no source file:
suite.run(test_result)
test: __main__.MyTest.test_one
failure: __main__.MyTest.test_one [
Traceback (most recent call last):
File "<stdin>", line 3, in test_one
AssertionError
]
I was trying to play with subunit in ipython notebook:
import unittest
class MyTest( unittest. TestCase) :
def test_one(self):
assert True
def test_two(self):
assert False, "two failed..."
suite1 = unittest. TestLoader( ).loadTestsFrom TestCase( MyTest)
import subunit
import sys
test_result = subunit. TestProtocolCli ent(sys. stdout) run(test_ result)
suite1.
The traceback I get is: input-5- 0e0da22da8b3> ", line 6, in <module> run(test_ result) python2. 7/unittest/ suite.py" , line 108, in run python2. 7/unittest/ case.py" , line 391, in __call__ python2. 7/unittest/ case.py" , line 331, in run addFailure( self, sys.exc_info()) drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ subunit/ __init_ _.py", line 668, in addFailure _addOutcome( "failure" , test, error=error, details=details) drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ subunit/ __init_ _.py", line 697, in _addOutcome t(error, test) drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ testtools/ content. py", line 142, in __init__ info_to_ unicode( err, test) drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ testtools/ content. py", line 169, in _exc_info_ to_unicode exception( exctype, value, tb, length) drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ testtools/ compat. py", line 352, in _format_exc_info drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ testtools/ compat. py", line 289, in _get_source_ encoding linecache. cache[filename] ) drakeol/ virtualenvs/ dvvtools/ local/lib/ python2. 7/site- packages/ testtools/ compat. py", line 261, in _detect_encoding
Traceback (most recent call last):
File "<ipython-
suite1.
File "/usr/lib/
test(result)
File "/usr/lib/
return self.run(*args, **kwds)
File "/usr/lib/
result.
File "/home/
self.
File "/home/
tb_content = TracebackConten
File "/home/
value = self._exc_
File "/home/
msgLines = format_
File "/home/
if evalue is None:
File "/home/
newtuple = _EncodingTuple(
File "/home/
# Source starting with UTF-8 BOM is either UTF-8 or a SyntaxError
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128)
When I run the same code in a normal python file (utf-8 encoding) it runs fine and I see subunit output on stdout: _.MyTest. test_one _.MyTest. test_one _.MyTest. test_two _.MyTest. test_two [ .py", line 8, in test_two
$ python subunitscratch.py
test: __main_
successful: __main_
test: __main_
failure: __main_
Traceback (most recent call last):
File "subunitscratch
assert False, "two failed..."
AssertionError: two failed...
]
I'm guessing it's to do with the fact that running in ipython notebook means there's no encoding for the source file of a traceback... =0.0.8 subunit= =0.0.8
Python 2.7.3
testrepository=
testtools==0.9.22
nose-subunit==0.2
python-
Aside: when I run the same code in the vanilla interpreter it runs ok but the traceback is less informative as there's no source file: test_result) _.MyTest. test_one _.MyTest. test_one [
suite.run(
test: __main_
failure: __main_
Traceback (most recent call last):
File "<stdin>", line 3, in test_one
AssertionError
]