Skip to content

Commit

Permalink
test: fix failing tests after osm-rawdata usage
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Oct 8, 2023
1 parent 33a04aa commit efd0729
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 109 deletions.
4 changes: 2 additions & 2 deletions osm_fieldwork/make_data_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class MakeExtract(object):

def __init__(
self,
uri: str,
dburi: str,
config: str,
xlsfile: str,
):
Expand All @@ -76,7 +76,7 @@ def __init__(
Returns:
(MakeExtract): An instance of this object
"""
self.db = PostgresClient(uri, f"{rootdir}/data_models/{config}")
self.db = PostgresClient(dburi, f"{rootdir}/data_models/{config}")
# path = Path(config)
# if path.suffix == '.yaml':
# self.qc.parseYaml(f"{rootdir}/data_models/{config}")
Expand Down
11 changes: 8 additions & 3 deletions osm_fieldwork/odk_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@
from cpuinfo import get_cpu_info
from geojson import Point
from haversine import Unit, haversine
from osm_rawdata.postgres import PostgresClient
from shapely.geometry import mapping, shape
from thefuzz import fuzz

from osm_fieldwork.convert import escape
from osm_fieldwork.make_data_extract import PostgresClient, uriParser
from osm_fieldwork.osmfile import OsmFile

# Instantiate logger
log = logging.getLogger(__name__)

# Find the other files for this project
import osm_fieldwork as of

rootdir = of.__path__[0]

# The number of threads is based on the CPU cores
info = get_cpu_info()
cores = info["count"]
Expand Down Expand Up @@ -67,11 +72,11 @@ def __init__(
# PG: is the same prefix as ogr2ogr
# "[user[:password]@][netloc][:port][/dbname]"
if source[0:3] == "PG:":
uri = uriParser(source[3:])
uri = source[3:]
# self.source = "underpass" is not support yet
# Each thread needs it's own connection to postgres to avoid problems.
for _thread in range(0, cores + 1):
db = PostgresClient(dbhost=uri["dbhost"], dbname=uri["dbname"], dbuser=uri["dbuser"], dbpass=uri["dbpass"])
db = PostgresClient(uri, f"{rootdir}/data_models/{config}")
self.postgres.append(db)
if boundary:
self.clip(boundary, db)
Expand Down
104 changes: 0 additions & 104 deletions tests/test_uriparser.py

This file was deleted.

0 comments on commit efd0729

Please sign in to comment.