addDetail does not work with binary content in python3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testtools |
Invalid
|
Undecided
|
Unassigned |
Bug Description
As a user of the testtools library, I would like to support adding details to test cases in binary format for python3. The following is a scenario to reproduce the bug. As a result of this error, the details of the test are excluded from the subunit streams generated in python3. I can provide more details on the subunit stream if that is desired.
=======
Test case used to add attachment
=======
# note here I have to use utf8 encoding for python3
# https:/
class TestReadSubunit
def test_get_
dur = subunit.
ctnt_type = content_
if sys.version_info < (3, 0):
data = bytes('data')
else:
data = bytes('data', 'utf8')
ctnt = content.
# adding binary content in python3 causes an error in the __repr__ call and self.getDetails() call
(py35) ubuntu@
Tests running...
> /home/ubuntu/
-> self.addDetail(
(Pdb) ctnt
*** TypeError: sequence item 0: expected a bytes-like object, int found
(Pdb) self.getDetails()
*** TypeError: sequence item 0: expected a bytes-like object, int found
# no problem in python2
(py27) ubuntu@
Tests running...
> /home/ubuntu/
-> self.addDetail(
(Pdb) ctnt
<Content type=applicatio
(Pdb) self.getDetails()
{'test binary content': <Content type=applicatio
summary: |
- addDetails does not work with binary content in python3 + addDetail does not work with binary content in python3 |
This is more likely a bug with the Content object not being able to join a binary string together rather than the addDetail method "working" correctly.