449 |
The name of the postgis_sql file is determined by find_postgis_sql() |
The name of the postgis_sql file is determined by find_postgis_sql() |
450 |
- psycopg can be imported successfully. |
- psycopg can be imported successfully. |
451 |
""" |
""" |
452 |
|
# run_command currently uses Popen4 which is not available under |
453 |
|
# Windows, for example. |
454 |
|
if not hasattr(popen2, "Popen4"): |
455 |
|
return "Can't run PostGIS test because popen2.Popen4 does not exist" |
456 |
|
|
457 |
try: |
try: |
458 |
run_command(["pg_ctl", "--help"], None) |
run_command(["pg_ctl", "--help"], None) |
459 |
except RuntimeError: |
except RuntimeError: |
486 |
if _cannot_run_postgis_tests: |
if _cannot_run_postgis_tests: |
487 |
raise support.SkipTest(_cannot_run_postgis_tests) |
raise support.SkipTest(_cannot_run_postgis_tests) |
488 |
|
|
489 |
|
def skip_if_addgeometrycolumn_does_not_use_quote_ident(): |
490 |
|
"""Skip a test if the AddGeometryColumn function doesn't use quote_ident |
491 |
|
|
492 |
|
If the AddGeometryColumn function doesn't use quote_ident it doesn't |
493 |
|
support unusual table or column names properly, that is, it will |
494 |
|
fail with errors for names that contain spaces or double quotes. |
495 |
|
|
496 |
|
The test performed by this function is a bit simplistic because it |
497 |
|
only tests whether the string 'quote_ident' occurs anywhere in the |
498 |
|
postgis.sql file. This will hopefully works because when this was |
499 |
|
fixed in postgis CVS AddGeometryColumn was the first function to use |
500 |
|
quote_ident. |
501 |
|
""" |
502 |
|
f = file(find_postgis_sql()) |
503 |
|
content = f.read() |
504 |
|
f.close() |
505 |
|
if content.find("quote_ident") < 0: |
506 |
|
raise support.SkipTest("AddGeometryColumn doesn't use quote_ident") |
507 |
|
|
508 |
def coords_to_point(coords): |
def coords_to_point(coords): |
509 |
"""Return string with a WKT representation of the point in coords""" |
"""Return string with a WKT representation of the point in coords""" |
510 |
x, y = coords[0] |
x, y = coords[0] |