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

Add Python 2.6 support. #21

Merged
merged 1 commit into from
Mar 2, 2014
Merged

Add Python 2.6 support. #21

merged 1 commit into from
Mar 2, 2014

Conversation

charz
Copy link

@charz charz commented Feb 24, 2014

Hi Lczub,

I found the piece of code can't work on Python 2.6. And I do some modify. Please review it.
Thanks,

Charles

@lczub
Copy link
Owner

lczub commented Feb 24, 2014

Hello Charles,
well I really like the code line, you want to replace. Is this the only needed change to support py26? I didn't use it currently, cause thought it would running out of PY support.

I was rather thinking about a Py3x support (in the future) than a Py26 (back porting) support
(see old link http://www.findbestopensource.com/product/testlink-api-python-client)

Would it be an alternative, if we create a py26 branch to collect your changes, but not merge them into main?

Greetings Luiko

@lczub
Copy link
Owner

lczub commented Feb 24, 2014

The problematic line uses a Py31 feature, back ported to Py27

  • Dictionary and set comprehensions ({i: i*2 for i in range(3)}).

@charz
Copy link
Author

charz commented Feb 25, 2014

  • Is this the only needed change to support py26?
    The default module xmlrpclib.py in py26 is not work in my desktop, I had replaced it with my xmlrpclib.py (but I didn't summit it with this patch).
    And add my patch that I send to you.

The patch is to avoid:

  1. pip to show error message when user install package (pip install testlink-api-python-client) in py26.
  2. Execution error in py26.

To create an alternative will be fine for me. Depend on your plan.

@lczub lczub added the bug label Feb 25, 2014
@lczub lczub added this to the v0.4.8 milestone Feb 25, 2014
@lczub
Copy link
Owner

lczub commented Feb 25, 2014

I will try to build up a PY26 test environment during the next week and then look, how I could integrated your patch.

@charz
Copy link
Author

charz commented Feb 26, 2014

My environment

os: ubuntu 10.04
python: Python 2.6.5 (r265:79063, Oct 1 2012, 22:04:36)
testlink: 1.9.3 (Prague)

The log of pip install

(testlink)[8:31][charz@Ivy: ~/personal] $ pip install TestLink-API-Python-client
Downloading/unpacking TestLink-API-Python-client
  Downloading TestLink-API-Python-client-0.4.7.zip (74kB): 74kB downloaded
  Running setup.py (path:/home/charz/ENV/testlink/build/TestLink-API-Python-client/setup.py) egg_info for package TestLink-API-Python-client
Installing collected packages: TestLink-API-Python-client
  Running setup.py install for TestLink-API-Python-client
    SyntaxError: ('invalid syntax', ('/home/charz/ENV/testlink/lib/python2.6/site-packages/testlink/testlinkapigeneric.py', 931, 46, '        return {nameList[x] : valueList[x] for x in range(len(nameList)) }\n'))

Successfully installed TestLink-API-Python-client
Cleaning up...

About xmlrpc problem

The problem of xmlrpclib.py in py26 is can't decode the xml data from testlink. It seem add '\n' in front of xml data. It broken the xml parsing.

Modify xmlrpclib.py

         def feed(self, data):
              print '#%s#'% data
              _data = data.strip('\n')
              print '#%s#'% _data
              self._parser.Parse(_data, 0)

Response from testlink

#
<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <string> Testlink API Version: 1.0 initially written by Asiel Brumfield
 with contributions by TestLink development Team</string>
      </value>
    </param>
  </params>
</methodResponse>
#
#<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <string> Testlink API Version: 1.0 initially written by Asiel Brumfield
 with contributions by TestLink development Team</string>
      </value>
    </param>
  </params>
</methodResponse>#

Hope these information can help you.

lczub added a commit that referenced this pull request Mar 2, 2014
Add Python 2.6 support.
@lczub lczub merged commit 4d4eec7 into lczub:master Mar 2, 2014
lczub pushed a commit that referenced this pull request Mar 2, 2014
@lczub
Copy link
Owner

lczub commented Mar 2, 2014

Hello Charles,
I created a pre-release under https://github.com/lczub/TestLink-API-Python-client/releases/tag/v0.4.8-Beta, which should be installable under Py26 and Py27. Could you test it?

I found an additional precondition for Py26: the module argparse must be installed (see release notes).

I tested it with

  • client Py266 and Py275 under Win7
  • server TL 1.9.9 on Debian 7, psql 9.2
    and had no problems with the xml parsing.
    Maybe your '\n' problems are related to your "older" 1.9.3 TL version and meanwhile solved in TL 1.9.9?

Greetings Luiko

@charz
Copy link
Author

charz commented Mar 3, 2014

Hi Luiko,

I tested pre-release v0.4.8 beta, It works fine on my environments include Py26(ubuntu 10.04) andPy27 (ubuntu 12.04).

About the testlink(1.9.3) problem, I think that should be fixed in newer version.

Thanks

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

Successfully merging this pull request may close these issues.

2 participants