Skip to content

Commit

Permalink
fix tests, fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vvmruder committed May 30, 2023
1 parent 89f9484 commit c733ef6
Show file tree
Hide file tree
Showing 13 changed files with 35,548 additions and 10,284 deletions.
4 changes: 3 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[run]
source =
src/geolink2oereb
omit =
geolink2oereb/tests/*
src/geolink2oereb/lib/interfaces/oerebkrmtrsfr/v2_0/classes.py
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ lint: .venv/requirements.timestamp

.PHONY: test
test: .venv/requirements.timestamp
.venv/bin/py.test -vv --cov=geolink2oereb --cov-report term-missing:skip-covered tests
.venv/bin/py.test -vv --cov=src/geolink2oereb --cov-config .coveragerc --cov-report term-missing:skip-covered tests


.PHONY: check
Expand Down
6 changes: 6 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[pytest]
pythonpath = src
python_files =
test/test_*.py
collect_ignore =
src/geolink2oereb/lib/interfaces/oerebkrmtrsfr/v2_0/classes.py
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[flake8]
exclude = .venv,.cache,.tox,.idea,build,dist,doc
per-file-ignores =
src/geolink2oereb/lib/interfaces/oerebkrmtrsfr/v2_0/classes.py:E501,F841,E266,F821,E203
max-line-length = 110

[bdist_wheel]
Expand Down
83 changes: 44 additions & 39 deletions src/geolink2oereb/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,70 @@

from geolink2oereb.transform import run

logging.basicConfig(
level='DEBUG',
format='%(asctime)s [%(levelname)s] %(message)s'
)
logging.basicConfig(level="DEBUG", format="%(asctime)s [%(levelname)s] %(message)s")

log = logging.getLogger(__name__)


def load_documents():
parser = optparse.OptionParser(
usage='usage: %prog [options]',
description='Download all documents to a oereblex geolinkID'
usage="usage: %prog [options]",
description="Download all documents to a oereblex geolinkID",
)
parser.add_option(
'-l', '--geolink_id',
dest='geolink_id',
metavar='GEOLINKID',
type='integer',
help='The the ID to load the documents for.'
"-l",
"--geolink_id",
dest="geolink_id",
metavar="GEOLINKID",
type="integer",
help="The the ID to load the documents for.",
)
parser.add_option(
'-t', '--themecode',
dest='theme_code',
metavar='THEMECODE',
type='string',
help='The theme code which the documents are loaded for. That need to fit the passed pyramid_oereb config YML.'
"-t",
"--themecode",
dest="theme_code",
metavar="THEMECODE",
type="string",
help="The theme code which the documents are loaded for. That need to fit the passed pyramid_oereb"
"config YML.",
)
parser.add_option(
'-p', '--pyramid-oereb-config-path',
dest='pyramid_oereb_config_path',
help='The absolute path to the pyramid_oereb.yml config file to read all the settings for ÖREBlex and the translations of codes.'
"-p",
"--pyramid-oereb-config-path",
dest="pyramid_oereb_config_path",
help="The absolute path to the pyramid_oereb.yml config file to read all the settings for ÖREBlex "
"and the translations of codes.",
)
parser.add_option(
'-c', '--source-class-path',
dest='source_class_path',
metavar='SOURCECLASSPATH',
type='string',
default='geolink2oereb.lib.interfaces.pyramid_oereb.OEREBlexSourceCustom',
help='The dotted python path to the class which is used for the ÖREBlex handling.'
"-c",
"--source-class-path",
dest="source_class_path",
metavar="SOURCECLASSPATH",
type="string",
default="geolink2oereb.lib.interfaces.pyramid_oereb.OEREBlexSourceCustom",
help="The dotted python path to the class which is used for the ÖREBlex handling.",
)
parser.add_option(
'-s', '--section',
dest='section',
metavar='SECTION',
type='string',
default='pyramid_oereb',
help='The section which contains configuration (default is: pyramid_oereb).'
"-s",
"--section",
dest="section",
metavar="SECTION",
type="string",
default="pyramid_oereb",
help="The section which contains configuration (default is: pyramid_oereb).",
)
parser.add_option(
'--c2ctemplate-style',
dest='c2ctemplate_style',
"--c2ctemplate-style",
dest="c2ctemplate_style",
default=False,
help='Is the yaml file using a c2ctemplate style (starting with vars)'
help="Is the yaml file using a c2ctemplate style (starting with vars)",
)
parser.add_option(
'-o', '--outfile-path',
dest='outfile_path',
default=f'/tmp/{str(uuid.uuid4())}.xml',
help='The absolute path where the output will be written to.'
"-o",
"--outfile-path",
dest="outfile_path",
default=f"/tmp/{str(uuid.uuid4())}.xml",
help="The absolute path where the output will be written to.",
)

options, args = parser.parse_args()
Expand All @@ -72,7 +77,7 @@ def load_documents():
options.pyramid_oereb_config_path,
options.section,
options.source_class_path,
options.c2ctemplate_style
options.c2ctemplate_style,
)
with open(options.outfile_path) as fh:
for element in oerebkrmtrsfr:
Expand Down
Loading

0 comments on commit c733ef6

Please sign in to comment.