[Django] #25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole

49 views
Skip to first unread message

Django

unread,
Jun 20, 2015, 8:36:12 AM6/20/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
--------------------------------------+--------------------
Reporter: nedbat | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+--------------------
I wanted to run the unit tests on my Mac. I followed the instructions:

{{{
[:/src/django/nedbat/tests] master ± mkvirtualenv django
New python executable in django/bin/python
Installing setuptools, pip...done.
[:/src/django/nedbat/tests] [django] master ± pip install -r
requirements/py2.txt
... many lines elided ...
Successfully installed bcrypt docutils jinja2 numpy Pillow PyYAML pytz
selenium sqlparse python-memcached mock cffi six markupsafe pycparser
Cleaning up...
[:/src/django/nedbat/tests] [django] master ± PYTHONPATH=..:$PYTHONPATH
./runtests.py
Testing against Django installed in '/src/django/nedbat/django'
Traceback (most recent call last):
File "./runtests.py", line 435, in <module>
options.debug_sql)
File "./runtests.py", line 239, in django_tests
state = setup(verbosity, test_labels)
File "./runtests.py", line 218, in setup
apps.set_installed_apps(settings.INSTALLED_APPS)
File "/src/django/nedbat/django/apps/registry.py", line 318, in
set_installed_apps
self.populate(installed)
File "/src/django/nedbat/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/src/django/nedbat/django/apps/config.py", line 198, in
import_models
self.models_module = import_module(models_module_name)
File
"/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py",
line 37, in import_module
__import__(name)
File "/src/django/nedbat/tests/gis_tests/models.py", line 10, in
<module>
from django.contrib.gis.db import models
File "/src/django/nedbat/django/contrib/gis/db/models/__init__.py", line
5, in <module>
from django.contrib.gis.db.models.aggregates import * # NOQA
File "/src/django/nedbat/django/contrib/gis/db/models/aggregates.py",
line 1, in <module>
from django.contrib.gis.db.models.fields import ExtentField
File "/src/django/nedbat/django/contrib/gis/db/models/fields.py", line
4, in <module>
from django.contrib.gis.gdal.raster.source import GDALRaster
File "/src/django/nedbat/django/contrib/gis/gdal/raster/source.py", line
6, in <module>
from django.contrib.gis.gdal.driver import Driver
File "/src/django/nedbat/django/contrib/gis/gdal/driver.py", line 5, in
<module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as
rcapi
File "/src/django/nedbat/django/contrib/gis/gdal/prototypes/ds.py", line
9, in <module>
from django.contrib.gis.gdal.libgdal import lgdal
File "/src/django/nedbat/django/contrib/gis/gdal/libgdal.py", line 45,
in <module>
'", "'.join(lib_names))
django.contrib.gis.gdal.error.GDALException: Could not find the GDAL
library (tried "gdal", "GDAL", "gdal1.11.0", "gdal1.10.0", "gdal1.9.0",
"gdal1.8.0", "gdal1.7.0"). Try setting GDAL_LIBRARY_PATH in your settings.
}}}

A quick look at how to install gdal lead to scary pages, and a requirement
to install GEOS, etc.

Looking at tests/gis_tests/models.py, it looks like it's trying to neuter
itself if the GIS requirements aren't installed, but I guess it isn't
doing it well enough?

I'd be glad to hack on making this better if someone could guide me on the
philosophy to follow.

--
Ticket URL: <https://code.djangoproject.com/ticket/25011>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 20, 2015, 8:55:05 AM6/20/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
--------------------------------------+------------------------------------

Reporter: nedbat | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timgraham):

* needs_docs: => 0
* needs_better_patch: => 0
* version: 1.8 => master
* needs_tests: => 0
* stage: Unreviewed => Accepted


Comment:

Oops, that broke in a patch committed yesterday. I'll ping the author and
ask him to take a look.

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:1>

Django

unread,
Jun 22, 2015, 6:27:43 AM6/22/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
--------------------------------------+------------------------------------

Reporter: nedbat | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------

Comment (by yellowcap):

Here is a possible solution, I think the RasterField needs to be imported
separately from the geometry fields, as it depends on gdal but the geom
fields can be used with only geos as well. So the proposed patch splits
the GIS fields modlue in submodules.

https://github.com/django/django/pull/4905

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:2>

Django

unread,
Jun 22, 2015, 1:23:25 PM6/22/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
-------------------------------------+-------------------------------------
Reporter: nedbat | Owner: nobody
Type: | Status: closed
Cleanup/optimization |

Component: Testing framework | Version: master
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => duplicate


Comment:

Let's just reference the original ticket when committing this.

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:3>

Django

unread,
Jun 22, 2015, 1:54:27 PM6/22/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
-------------------------------------+-------------------------------------
Reporter: nedbat | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Testing framework | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by nedbat):

You've marked this ticket as a duplicate of a closed ticket? What will
track the work to fix the problem?

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:4>

Django

unread,
Jun 22, 2015, 2:25:51 PM6/22/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
-------------------------------------+-------------------------------------
Reporter: nedbat | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Testing framework | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by timgraham):

We could reopen the original ticket, but don't worry, the pull request
won't get lost.

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:5>

Django

unread,
Jun 22, 2015, 2:35:14 PM6/22/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
-------------------------------------+-------------------------------------
Reporter: nedbat | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Testing framework | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by nedbat):

I didn't make a pull request for this...?

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:6>

Django

unread,
Jun 22, 2015, 2:51:55 PM6/22/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
-------------------------------------+-------------------------------------
Reporter: nedbat | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Testing framework | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by bmispelon):

Replying to [comment:6 nedbat]:


> I didn't make a pull request for this...?

Tim is talking about https://github.com/django/django/pull/4905

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:7>

Django

unread,
Jun 23, 2015, 12:10:42 PM6/23/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
-------------------------------------+-------------------------------------
Reporter: nedbat | Owner: nobody

Type: | Status: closed
Cleanup/optimization |
Component: Testing framework | Version: master
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by carljm):

It's not a big deal, and I'm sure it's true that the PR won't get lost,
but I think Ned is right, and there wasn't a good reason to close this
ticket as a duplicate (especially as a duplicate of a ticket it clearly
isn't a duplicate of - "problem caused by fix for some other ticket" is
not the same thing as "duplicate").

If there's a known problem in master (which there is right now), a ticket
with a clear description of that problem (which this is) should be left
open until a fix for the problem is merged to master. And that fix should
reference the ticket which is a clear description of the problem it's
fixing (and perhaps also the original ticket whose fix caused the problem
in the first place.)

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:8>

Django

unread,
Jun 23, 2015, 2:24:49 PM6/23/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
--------------------------------------+------------------------------------

Reporter: nedbat | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Testing framework | Version: master
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by aaugustin):

* status: closed => new
* resolution: duplicate =>


--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:9>

Django

unread,
Jun 23, 2015, 4:12:22 PM6/23/15
to django-...@googlegroups.com
#25011: Running unit tests on Mac takes me down a GDAL installation rabbit hole
--------------------------------------+------------------------------------
Reporter: nedbat | Owner: nobody
Type: Cleanup/optimization | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed

* resolution: => fixed


Comment:

In [changeset:"c0fff64486198ee8885f4f951399a3675f01e3cd" c0fff64]:
{{{
#!CommitTicketReference repository=""
revision="c0fff64486198ee8885f4f951399a3675f01e3cd"
Fixed #25011, Refs #23804 -- Added check for GDAL on RasterField
initialization
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25011#comment:10>

Reply all
Reply to author
Forward
0 new messages