Если вы посмотрите на код из pyral
, вы получите следующую подпись:
def deleteAttachment(self, artifact, filename):
"""
Still unclear for WSAPI v2.0 if Attachment items can be deleted.
Apparently AttachmentContent items can be deleted.
"""
art_type, artifact = self._realizeArtifact(artifact)
if not art_type:
return False
current_attachments = [att for att in artifact.Attachments]
hits = [att for att in current_attachments if att.Name == filename]
if not hits:
return False
...
Таким образом, первый аргумент - это артефакт (то есть объект тестового примера), не строка.
Может быть так:
import logging
logging.basicConfig(format="%(levelname)s:%(module)s:%(lineno)d:%(msg)s")
try:
# Get number of existing steps
testcase = rally.get("TestCase", query="FormattedID = %s" % tcid, instance=True)
has_been_deleted = rally.deleteAttachment(testcase, filename)
if not has_been_deleted:
msg = "Attachment '{0}' of Test Case {1} not deleted successfully"
logging.warning(msg.format(filename, testcase.FormattedID))
except RallyRESTAPIError as e:
logging.error("Error while deleting attachment '{0}': {1}".format(filename, e))