Skip to content

py3 - testlinkapigeneric_online_test under py34 - attachment tests raise TypeError: expected bytes-like object, not str #34

Closed
@lczub

Description

@lczub

Under py341, the attachment related unit tests in

raises a TypeError: expected bytes-like object, not str

affected test are:

  • test_uploadAttachment_unknownID
  • test_uploadExecutionAttachment_unknownID
  • test_uploadRequirementAttachment_unknownID
  • test_uploadRequirementSpecificationAttachment_unknownID
  • test_uploadTestCaseAttachment_unknownID
  • test_uploadTestProjectAttachment_unknownID
  • test_uploadTestSuiteAttachment_unknownID

Example

ERROR: test_uploadAttachment_unknownID (utest-online.testlinkapigeneric_online_test.TestLinkAPIOnlineTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Programme\Python34\lib\base64.py", line 519, in _input_type_check
    m = memoryview(s)
TypeError: memoryview: str object does not have the buffer interface

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Projekte\git\TestLink-API-Python-client\test\utest-online\testlinkapigeneric_online_test.py", line 267, in test_uploadAttachment_unknownID
    title='title 4713', description='descr. 4714')
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkdecorators.py", line 156, in wrapperAddAttachment
    argsAttachment = self._getAttachmentArgs(attachmentfile)
  File "D:\Projekte\git\TestLink-API-Python-client\src\testlink\testlinkapigeneric.py", line 1241, in _getAttachmentArgs
    'content':base64.encodestring(attachmentfile.read())
  File "D:\Programme\Python34\lib\base64.py", line 548, in encodestring
    return encodebytes(s)
  File "D:\Programme\Python34\lib\base64.py", line 536, in encodebytes
    _input_type_check(s)
  File "D:\Programme\Python34\lib\base64.py", line 522, in _input_type_check
    raise TypeError(msg) from err
TypeError: expected bytes-like object, not str

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions