]> git.openstreetmap.org Git - nominatim.git/blobdiff - tests/steps/osm2pgsql_setup.py
Merge pull request #416 from lonvia/dead-code-removal
[nominatim.git] / tests / steps / osm2pgsql_setup.py
index 759ca93d85594333ee171fe08027b8e3e582793f..4b03b1ea48efcd97011d8920e7a1e61900da7b42 100644 (file)
@@ -140,7 +140,7 @@ def osm2pgsql_load_place(step):
     world.osm2pgsql.sort(cmp=_sort_xml_entries)
 
     # create a OSM file in /tmp
     world.osm2pgsql.sort(cmp=_sort_xml_entries)
 
     # create a OSM file in /tmp
-    with tempfile.NamedTemporaryFile(dir='/tmp', delete=False) as fd:
+    with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.osm', delete=False) as fd:
         fname = fd.name
         fd.write("<?xml version='1.0' encoding='UTF-8'?>\n")
         fd.write('<osm version="0.6" generator="test-nominatim" timestamp="2014-08-26T20:22:02Z">\n')
         fname = fd.name
         fd.write("<?xml version='1.0' encoding='UTF-8'?>\n")
         fd.write('<osm version="0.6" generator="test-nominatim" timestamp="2014-08-26T20:22:02Z">\n')
@@ -154,8 +154,9 @@ def osm2pgsql_load_place(step):
     logger.debug( "Filename: %s" % fname)
 
     cmd = [os.path.join(world.config.source_dir, 'utils', 'setup.php')]
     logger.debug( "Filename: %s" % fname)
 
     cmd = [os.path.join(world.config.source_dir, 'utils', 'setup.php')]
-    cmd.extend(['--osm-file', fname, '--import-data'])
-    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    cmd.extend(['--osm-file', fname, '--import-data','--osm2pgsql-cache', '300'])
+    proc = subprocess.Popen(cmd, cwd=world.config.source_dir,
+                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     (outp, outerr) = proc.communicate()
     assert (proc.returncode == 0), "OSM data import failed:\n%s\n%s\n" % (outp, outerr)
 
     (outp, outerr) = proc.communicate()
     assert (proc.returncode == 0), "OSM data import failed:\n%s\n%s\n" % (outp, outerr)
 
@@ -188,7 +189,7 @@ def osm2pgsql_update_place(step):
     world.run_nominatim_script('setup', 'index', 'index-noanalyse')
     world.run_nominatim_script('setup', 'create-functions', 'create-partition-functions', 'enable-diff-updates')
 
     world.run_nominatim_script('setup', 'index', 'index-noanalyse')
     world.run_nominatim_script('setup', 'create-functions', 'create-partition-functions', 'enable-diff-updates')
 
-    with tempfile.NamedTemporaryFile(dir='/tmp', delete=False) as fd:
+    with tempfile.NamedTemporaryFile(dir='/tmp', suffix='.osc', delete=False) as fd:
         fname = fd.name
         fd.write("<?xml version='1.0' encoding='UTF-8'?>\n")
         fd.write('<osmChange version="0.6" generator="Osmosis 0.43.1">\n')
         fname = fd.name
         fd.write("<?xml version='1.0' encoding='UTF-8'?>\n")
         fd.write('<osmChange version="0.6" generator="Osmosis 0.43.1">\n')
@@ -204,7 +205,8 @@ def osm2pgsql_update_place(step):
 
     cmd = [os.path.join(world.config.source_dir, 'utils', 'update.php')]
     cmd.extend(['--import-diff', fname])
 
     cmd = [os.path.join(world.config.source_dir, 'utils', 'update.php')]
     cmd.extend(['--import-diff', fname])
-    proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    proc = subprocess.Popen(cmd, cwd=world.config.source_dir,
+                            stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     (outp, outerr) = proc.communicate()
     assert (proc.returncode == 0), "OSM data update failed:\n%s\n%s\n" % (outp, outerr)
 
     (outp, outerr) = proc.communicate()
     assert (proc.returncode == 0), "OSM data update failed:\n%s\n%s\n" % (outp, outerr)