import os import re import shutil import sys import traceback import config from openaddr.jobs import setup_logger from shapely.wkt import dumps from utils import fetch, unzip, rlistdir, import_with_fiona, import_csv _L = logging.getLogger('openaddr.parcels') csv.field_size_limit(sys.maxsize) setup_logger() def parse_source(source, idx, header): """ Import data from a single source based on the data type. """ path = '{}/{}'.format(config.workspace_dir, idx) if not os.path.exists(path): os.makedirs(path) cache_url = source[header.index('cache')] cache_filename = re.search('/[^/]*$', cache_url).group() fetch(cache_url, path + cache_filename) files = rlistdir(path) for f in files:
python test.py -l TestOA.test_process All logging is suppressed unless --logall or -l specified ~/.openaddr-logging-test.json can also be used to configure log behavior """ import unittest import sys import logging from openaddr import jobs from openaddr.tests import TestOA from openaddr.tests.sample import TestSample from openaddr.tests.cache import TestCacheExtensionGuessing, TestCacheEsriDownload from openaddr.tests.conform import TestConformCli, TestConformTransforms, TestConformMisc, TestConformCsv from openaddr.tests.expand import TestExpand from openaddr.tests.render import TestRender from openaddr.tests.util import TestEsri2GeoJSON from openaddr.tests.ci import TestHook if __name__ == '__main__': # Allow the user to turn on logging with -l or --logall # unittest.main() has its own command line so we slide this in first level = logging.CRITICAL for i, arg in enumerate(sys.argv[1:]): if arg == "-l" or arg == "--logall": level = logging.DEBUG del sys.argv[i] jobs.setup_logger(log_level = level, log_config_file = "~/.openaddr-logging-test.json") unittest.main()
from openaddr import jobs from openaddr.tests import TestOA, TestState, TestPackage from openaddr.tests.sample import TestSample from openaddr.tests.cache import TestCacheExtensionGuessing, TestCacheEsriDownload from openaddr.tests.conform import TestConformCli, TestConformTransforms, TestConformMisc, TestConformCsv, TestConformLicense from openaddr.tests.render import TestRender from openaddr.tests.dotmap import TestDotmap from openaddr.tests.preview import TestPreview from openaddr.tests.util import TestUtilities from openaddr.tests.summarize import TestSummarizeFunctions from openaddr.tests.parcels import TestParcelsUtils, TestParcelsParse from openaddr.tests.ci import (TestHook, TestRuns, TestWorker, TestBatch, TestObjects, TestCollect, TestAPI, TestQueue, TestAuth, TestTileIndex) if __name__ == '__main__': # Allow the user to turn on logging with -l or --logall # unittest.main() has its own command line so we slide this in first level = logging.CRITICAL for i, arg in enumerate(sys.argv[1:]): if arg == "-l" or arg == "--logall": level = logging.DEBUG del sys.argv[i] jobs.setup_logger(log_level=level, log_config_file="~/.openaddr-logging-test.json") unittest.main()
import os import re import shutil import sys import traceback import config from openaddr.jobs import setup_logger from shapely.wkt import dumps from utils import fetch, unzip, rlistdir, import_with_fiona, import_csv _L = logging.getLogger('openaddr.parcels') csv.field_size_limit(sys.maxsize) setup_logger() def parse_source(source, idx, header): """ Import data from a single source based on the data type. """ path = '{}/{}'.format(config.workspace_dir, idx) if not os.path.exists(path): os.makedirs(path) cache_url = source[header.index('cache')] cache_filename = re.search('/[^/]*$', cache_url).group() fetch(cache_url, path + cache_filename) files = rlistdir(path)