Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError thrown in getProjectIDByNode #149

Open
elapfra opened this issue Oct 7, 2021 · 6 comments
Open

KeyError thrown in getProjectIDByNode #149

elapfra opened this issue Oct 7, 2021 · 6 comments
Assignees

Comments

@elapfra
Copy link

elapfra commented Oct 7, 2021

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)]

@lczub
Copy link
Owner

lczub commented Oct 7, 2021

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

@elapfra
Copy link
Author

elapfra commented Oct 7, 2021

Hi,

Thanks for the quick feedback.

I'm using the HEAD commit from this project (1fb0cd2)

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"

@lczub
Copy link
Owner

lczub commented Oct 10, 2021

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

@elapfra
Copy link
Author

elapfra commented Oct 11, 2021

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,

@lczub
Copy link
Owner

lczub commented Oct 11, 2021

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.

@lczub
Copy link
Owner

lczub commented Oct 20, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants