Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .deploy/create-dumps.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def files_description(version):

* If you plan to **use QGEP for production**, it is more likely you will be using the plain SQL `qgep_{version}_structure_with_value_lists.sql`.
* If you want to **give a try at QGEP**, you will likely restore the `qgep_{version}_structure_and_demo_data.backup` backup file.
""".format(
version=version
)
""".format(version=version)


def create_dumps():
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude: '^.*\.xtf|.*\.xml|.*\.ili|qgepqwat2ili/bin.*$'
repos:
# Fix end of files
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -14,7 +14,7 @@ repos:

# Remove unused imports/variables
- repo: https://github.com/PyCQA/autoflake
rev: v2.3.1
rev: v2.3.3
hooks:
- id: autoflake
args:
Expand All @@ -24,23 +24,23 @@ repos:

# Sort imports
- repo: https://github.com/pycqa/isort
rev: "6.0.1"
rev: "8.0.1"
hooks:
- id: isort
args:
- --profile
- black

# Black formatting
- repo: https://github.com/psf/black
rev: "25.1.0"
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "26.3.1"
hooks:
- id: black
args: ["--line-length=99"]

# tool to automatically upgrade syntax for newer versions of the language
- repo: https://github.com/asottile/pyupgrade
rev: v3.20.0
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py37-plus]
Expand Down
30 changes: 10 additions & 20 deletions test/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,12 @@ def test_update_with_outlet(self):
# it should be in the live table qgep_od.reach and qgep_od.reach_point
cur = self.cursor()
cur.execute(
psycopg2.sql.SQL(
"SELECT re.material, re.clear_height, rp.level, ws.co_level\
psycopg2.sql.SQL("SELECT re.material, re.clear_height, rp.level, ws.co_level\
FROM {schema}.reach re\
LEFT JOIN {schema}.reach_point rp ON rp.obj_id = re.fk_reach_point_from\
LEFT JOIN {schema}.wastewater_networkelement wn ON wn.obj_id = rp.fk_wastewater_networkelement\
LEFT JOIN {schema}.vw_qgep_wastewater_structure ws ON ws.obj_id = wn.fk_wastewater_structure\
WHERE ws.obj_id = %(obj_id)s"
).format(schema=psycopg2.sql.Identifier("qgep_od")),
WHERE ws.obj_id = %(obj_id)s").format(schema=psycopg2.sql.Identifier("qgep_od")),
{"obj_id": obj_id},
)
row = cur.fetchone()
Expand All @@ -221,11 +219,9 @@ def test_update_with_outlet(self):
row = self.select("file", obj_id, "qgep_od")
cur = self.cursor()
cur.execute(
psycopg2.sql.SQL(
"SELECT *\
psycopg2.sql.SQL("SELECT *\
FROM {schema}.file\
WHERE object = %(obj_id)s"
).format(schema=psycopg2.sql.Identifier("qgep_od")),
WHERE object = %(obj_id)s").format(schema=psycopg2.sql.Identifier("qgep_od")),
{"obj_id": obj_id},
)
row = cur.fetchone()
Expand Down Expand Up @@ -255,14 +251,12 @@ def test_update_with_wrong_material(self):
# it should be in the live table qgep_od.reach and qgep_od.reach_point
cur = self.cursor()
cur.execute(
psycopg2.sql.SQL(
"SELECT re.material, re.clear_height, rp.level, ws.co_level\
psycopg2.sql.SQL("SELECT re.material, re.clear_height, rp.level, ws.co_level\
FROM {schema}.reach re\
LEFT JOIN {schema}.reach_point rp ON rp.obj_id = re.fk_reach_point_from\
LEFT JOIN {schema}.wastewater_networkelement wn ON wn.obj_id = rp.fk_wastewater_networkelement\
LEFT JOIN {schema}.vw_qgep_wastewater_structure ws ON ws.obj_id = wn.fk_wastewater_structure\
WHERE ws.obj_id = %(obj_id)s"
).format(schema=psycopg2.sql.Identifier("qgep_od")),
WHERE ws.obj_id = %(obj_id)s").format(schema=psycopg2.sql.Identifier("qgep_od")),
{"obj_id": obj_id},
)
row = cur.fetchone()
Expand Down Expand Up @@ -330,14 +324,12 @@ def test_update_with_unexpected_inlet(self):
# it should be in the live table qgep_od.reach and qgep_od.reach_point
cur = self.cursor()
cur.execute(
psycopg2.sql.SQL(
"SELECT re.material, re.clear_height, rp.level, ws.co_level\
psycopg2.sql.SQL("SELECT re.material, re.clear_height, rp.level, ws.co_level\
FROM {schema}.reach re\
LEFT JOIN {schema}.reach_point rp ON rp.obj_id = re.fk_reach_point_from\
LEFT JOIN {schema}.wastewater_networkelement wn ON wn.obj_id = rp.fk_wastewater_networkelement\
LEFT JOIN {schema}.vw_qgep_wastewater_structure ws ON ws.obj_id = wn.fk_wastewater_structure\
WHERE ws.obj_id = %(obj_id)s"
).format(schema=psycopg2.sql.Identifier("qgep_od")),
WHERE ws.obj_id = %(obj_id)s").format(schema=psycopg2.sql.Identifier("qgep_od")),
{"obj_id": obj_id},
)
row = cur.fetchone()
Expand Down Expand Up @@ -431,14 +423,12 @@ def test_update_with_multiple_inlets(self):
# it should be in the live table qgep_od.reach and qgep_od.reach_point
cur = self.cursor()
cur.execute(
psycopg2.sql.SQL(
"SELECT re.material, re.clear_height, rp.level, ws.co_level\
psycopg2.sql.SQL("SELECT re.material, re.clear_height, rp.level, ws.co_level\
FROM {schema}.reach re\
LEFT JOIN {schema}.reach_point rp ON rp.obj_id = re.fk_reach_point_from\
LEFT JOIN {schema}.wastewater_networkelement wn ON wn.obj_id = rp.fk_wastewater_networkelement\
LEFT JOIN {schema}.vw_qgep_wastewater_structure ws ON ws.obj_id = wn.fk_wastewater_structure\
WHERE ws.obj_id = %(obj_id)s"
).format(schema=psycopg2.sql.Identifier("qgep_od")),
WHERE ws.obj_id = %(obj_id)s").format(schema=psycopg2.sql.Identifier("qgep_od")),
{"obj_id": obj_id},
)
row = cur.fetchone()
Expand Down
Loading