[test] Use datapath() in massive store tests
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 30 Nov 2015 10:18:22 +0100
changeset 10938 a24a13742f3c
parent 10937 eb05348b0e2d
child 10939 b30c2f49da57
[test] Use datapath() in massive store tests
dataimport/test/test_massive_store.py
--- a/dataimport/test/test_massive_store.py	Fri Nov 27 12:26:17 2015 +0100
+++ b/dataimport/test/test_massive_store.py	Mon Nov 30 10:18:22 2015 +0100
@@ -16,7 +16,6 @@
 # with this program. If not, see <http://www.gnu.org/licenses/>.
 """Massive store test case"""
 
-import os.path as osp
 import itertools
 
 from cubicweb.dataimport import ucsvreader
@@ -25,9 +24,6 @@
 from cubicweb.dataimport.massive_store import MassiveObjectStore
 
 
-HERE = osp.abspath(osp.dirname(__file__))
-
-
 def setUpModule():
     startpgcluster(__file__)
 
@@ -49,7 +45,7 @@
     def push_geonames_data(self, dumpname, store):
         # Push timezones
         cnx = store._cnx
-        for code, gmt, dst, raw_offset in ucsvreader(open(osp.join(HERE, 'data/timeZones.txt'), 'rb'),
+        for code, gmt, dst, raw_offset in ucsvreader(open(self.datapath('timeZones.txt'), 'rb'),
                                                      delimiter='\t'):
             cnx.create_entity('TimeZone', code=code, gmt=float(gmt),
                                     dst=float(dst), raw_offset=float(raw_offset))
@@ -208,7 +204,7 @@
     def test_simple_insert(self):
         with self.admin_access.repo_cnx() as cnx:
             store = MassiveObjectStore(cnx)
-            self.push_geonames_data(osp.join(HERE, 'data/geonames.csv'), store)
+            self.push_geonames_data(self.datapath('geonames.csv'), store)
             store.flush()
             store.commit()
             store.finish()
@@ -221,7 +217,7 @@
     def test_index_building(self):
         with self.admin_access.repo_cnx() as cnx:
             store = MassiveObjectStore(cnx)
-            self.push_geonames_data(osp.join(HERE, 'data/geonames.csv'), store)
+            self.push_geonames_data(self.datapath('geonames.csv'), store)
             store.flush()
 
             # Check index