-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
pytest-nunit/pytest_nunit/plugin.py
Lines 143 to 147 in 8e27275
| def add_attachment(self, file, description): | |
| r = self.nunit_xml.cases[self.id] | |
| if r['attachments'] is None: | |
| r['attachments'] = {} | |
| r['attachments'][file] = description |
Essentially, rewrite this to:
def add_attachment(self, file, description):
r = self.nunit_xml.cases[self.id]
r.setdefault('attachments', {})[os.fsdecode(file)] = description (Threw in the setdefault for fun - you don't have to keep it ;) )
There are likely other places that will need similar updating, but I haven't reviewed it all yet. I'd recommend fsdecode if it's available, as that will get you to a str on all platforms, but if you're still supported older versions you'll need a stub like:
def fake_fsdecode(p):
if isinstance(p, bytes_or_str_depending_on_python_version):
return p.decode(os.getfsencoding())
return str(p)Metadata
Metadata
Assignees
Labels
No labels