TestLink-API-Python-client
TestLink-API-Python-client copied to clipboard
KeyError thrown in getProjectIDByNode
Hi,
Thanks for this library, it works great.
However, I encounter this error while running "TestLinkExample.py"
Traceback (most recent call last):
File "/home/elapfra/code/TestLink-API-Python-client/example/TestLinkExample.py", line 713, in <module>
response = myTestLink.copyTCnewVersion(newTestCaseID_B,
File "/home/elapfra/code/TestLink-API-Python-client/src/testlink/testlinkapi.py", line 188, in copyTCnewVersion
return self._copyTC(origTestCaseId, changedAttributes, origVersion,
File "/home/elapfra/code/TestLink-API-Python-client/src/testlink/testlinkapi.py", line 258, in _copyTC
origArgItems['testprojectid'] = self.getProjectIDByNode(origTestCaseId)
File "/home/elapfra/code/TestLink-API-Python-client/src/testlink/testlinkapi.py", line 166, in getProjectIDByNode
node_path = self.getFullPath(int(a_nodeid))[a_nodeid]
KeyError: 563
It seems to me the dict should be accessed by string. This works. node_path = self.getFullPath(int(a_nodeid))[str(a_nodeid)]
Hello Elapfra, thanks for your response. It is interesting, cause before I published the releases the examples were working . So maybe it is an issue driven by special version combinations.
Could you tell me the versions from your current used
- python
- testlink server
- TestLink-API-Python-client
That might help to understand what happens.
Regards Luiko
Hi,
Thanks for the quick feedback.
I'm using the HEAD commit from this project (1fb0cd24)
VERSION = '0.8.2-dev148' TL_RELEASE = '1.9.20-fixed'
I deployed the bitnami container version of testlink
$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-testlink/master/docker-compose.yml > docker-compose.yml
$ docker-compose up -d
But their library is behind, so I copied latest libs from testlink project (branch testlink_1_9_20_fixed)
git clone https://github.com/TestLinkOpenSourceTRMS/testlink-code.git
docker cp lib testlinkcode_testlink_1:/opt/bitnami/testlink/.
Python 3.6 venv
Platform: "linux-x86_64" Python version: "3.6"
Hello Elapfra, that is real interesting. I tried to reproduce it and run also in failing TestLinkExample, but in a much earlier section (see issue #150 )
- your sample was able to run till line 713, my just till line 367
copy test in testlinkapi_offline_test.py are still working
- but they work with data, collected from older server responses
- what may happen is, that the server has change its api in this point. But if this was wanted or not is unclear.
What it makes difficult - testlink_1_9_20_fixed is not stable. So I can currently not clearly decide, if the issue is affected by a wanted change on the server side or an unwanted (bug) on the server side.
I like to investigate this, but it will take a while.
Regards Luiko
Hi @lczub
For you information, I succesfully ran all the TestLink-API-Python-client
examples (as you said it was after applying changes to the latest testlink-code project, and other changes to this project).
For what it's worth, I captured all changes I made to this project here, you could have a look if you are interested.
https://github.com/elapfra/TestLink-API-Python-client/commits/1.9.20_fixed
Thanks,
Thanks for sharing your changes - observed that you also had issue with uploadExecutionAttachmemts I will fix the failures step by step during the next days and will use #150 as overall log for the process. Hope will come soon to step getProjectIDByNode.
Hello Elapfra, with the latest #150 commit, I was able to run the examples without errors against TL 1.9.20_fixed and 1.9.19. I only disabled the failing uploadAttachment steps .
The copyTCnewVersion steps work without any code change.
My tests uses py 3.9 and TL server build with docker-compose from scratch as described in TestLink-API-Python-clinet/docker/README.md
Unfortunately, I'm not able to reproduce your issue.
Regards Luiko