Make the python tests runnable from any directory

But note that if run from a directory other that the base of the
package it is the installed package which is tested.
This commit is contained in:
Javier Goizueta 2016-02-19 11:56:09 +01:00
parent 845d56a091
commit fe167efca5
2 changed files with 9 additions and 3 deletions

View File

@ -5,3 +5,9 @@ plpy = MockPlPy()
import sys
sys.modules['plpy'] = plpy
import os
def fixture_file(name):
dir = os.path.dirname(os.path.realpath(__file__))
return os.path.join(dir, 'fixtures', name)

View File

@ -9,7 +9,7 @@ import unittest
#
# import sys
# sys.modules['plpy'] = plpy
from helper import plpy
from helper import plpy, fixture_file
import crankshaft.clustering as cc
from crankshaft import random_seeds
@ -26,8 +26,8 @@ class MoranTest(unittest.TestCase):
"table": "a_list",
"geom_col": "the_geom",
"num_ngbrs": 321}
self.neighbors_data = json.loads(open('test/fixtures/neighbors.json').read())
self.moran_data = json.loads(open('test/fixtures/moran.json').read())
self.neighbors_data = json.loads(open(fixture_file('neighbors.json')).read())
self.moran_data = json.loads(open(fixture_file('moran.json')).read())
def test_map_quads(self):
"""Test map_quads."""