mvantellingen / psycopg2-ctypes

ctypes port of psycopg2 (see https://github.com/chtd/psycopg2cffi)
Other
56 stars 59 forks source link

Compatibility with psycopg2 not complete #6

Closed dvarrazzo closed 12 years ago

dvarrazzo commented 13 years ago

Hi,

With a few simple patches, I've run the psycopg test suite against psycopg2 ctypes. The results are:

Ran 327 tests in 5.208s FAILED (failures=22, errors=222)

Please, have these tests pass before declaring that psycopg2-ctypes is any compatible with psycopg2.

From a cursory check to the code I can state that:

Psycopg2 is compatible with python from 2.4 to 3.2 and postgres from 7.4 to 9.1. You should state which minimum Py/PG version psycopg2-ctypes supports.

We have already in place a buildbot testing for regressions in psycopg2 against all the supported Py/PG versions (http://initd.org/buildbot/tgrid). I can have psycopg2-ctypes running in the same test harness against the version supported: I think it would be great QA.

You are very welcome on the psycopg mailing list for any help and to coordinate the development. I can give you a hand with patching the tests and the library. But before that, please make explicit what level of compatibility exists and is planned between the two implementations.

mvantellingen commented 13 years ago

Hi Daniele,

Thanks for the feedback. I know that this module doesn't give 100% complete compatibility with psycopg2. I guess that i should make that more clear in the readme. The basic idea was that this module allows you to use sqlalchemy and django with pypy. Thus it only currently implements a part of the psycopg2 API which is used by those packages.

Now I do actually like the idea to implement the complete API down the road, so getting the psycopg2 unittests intergrated would be very welcome.

I'm currently only interested in supporting python 2.7 myself, as I don't see any reason to use this module with cpython (and pypy is 2.7).

Buildbot tests would be awesome if it isn't too much work for you, but perhaps I should first update the unittests.

dvarrazzo commented 13 years ago

I'd trace this timeline:

  1. update the readme stating the current limits of the lib
  2. open a branch full-tests and drop in the tests from psycopg2. You may get them from https://github.com/dvarrazzo/psycopg (devel branch)
  3. tweak the test suite in order to work on pypy/ctypes. Conditionally drop the tests you totally don't care such as the mx-datetime unit test. If you tweak the unit test in a way that compatibility with cpython is maintained, I will integrate the patches in the main branch, and pulling future changes into -ctypes will be a piece of cake. You may find useful to write decorators such as @skip_on_ctypes (see example of @skip_if_* decorators in tests/testutils.py)
  4. Make the test pass.

Before that, let's say point 1.5, check if everything works with postgres 9.1, mostly string escaping of strings containing backslashes: I suspect you have problems in that area (as PQescapeStringConn returns different values with different settings of standard_conforming_string, and IIRC the E prefix is not to be used when the parameter is on).

If you arrive, let's say to 2, I will try to give you a hand on the real flesh, the parts 3 and 4.

dvarrazzo commented 12 years ago

I'd say we are ok with this :)