Search code examples
pythondjangodjango-testingdjango-testsmodel-mommy

Django: GEOSException on ModelMommy mommy.make function


getting a weird error from Model Mommy when I am trying to create a mommy model

GEOSException: Error encountered checking Geometry returned from GEOS C function "GEOSWKBReader_readHEX_r".

Weird thing is that the only goes stuff is in another function - which is actually successfully used by these other functions to create mommy models.


Solution

  • This error appear erroneous. It appears it had nothing to do directly GEOS.

    Rather I was missing a required field that is a foreign key to a models that has a Point field.

    This was giving me an error

        dossier = mommy.make('foo.Bar',
                             bar='bar',
                             created=timezone.now())
    

    This fixed the problem

        dossier = mommy.make('foo.Bar',
                             foo='foo',  # required foreign key field
                             bar='bar',
                             created=timezone.now())