[Tile-serving] [osm2pgsql-dev/osm2pgsql] Do area expire based on the actual polygon instead of the bbox (PR #2453)

Sarah Hoffmann notifications at github.com
Fri Feb 6 18:49:53 UTC 2026


@lonvia commented on this pull request.



> @@ -541,6 +564,21 @@ def check_program_output(context, kind):
         assert line in s,\
                f"Output '{line}' not found in {kind} output:\n{s}\n"
 
+ at then(r"the (?P<kind>\w+) output matches contents of (?P<result_file>.*)")
+def check_program_output_against_file(context, kind, result_file):
+    if kind == 'error':
+        s = context.osm2pgsql_outdata[1]
+    elif kind == 'standard':
+        s = context.osm2pgsql_outdata[0]
+    else:
+        assert not "Expect one of error, standard"
+
+    test_dir = (context.user_args.test_data_dir or Path('.')).resolve()
+    expected = open(test_dir / result_file, 'r').read()

Please use with here to close the file properly:

```
with open(...) as fd:
    expected = fd.read()
```

> @@ -541,6 +564,21 @@ def check_program_output(context, kind):
         assert line in s,\
                f"Output '{line}' not found in {kind} output:\n{s}\n"
 
+ at then(r"the (?P<kind>\w+) output matches contents of (?P<result_file>.*)")
+def check_program_output_against_file(context, kind, result_file):
+    if kind == 'error':
+        s = context.osm2pgsql_outdata[1]
+    elif kind == 'standard':
+        s = context.osm2pgsql_outdata[0]
+    else:
+        assert not "Expect one of error, standard"
+
+    test_dir = (context.user_args.test_data_dir or Path('.')).resolve()
+    expected = open(test_dir / result_file, 'r').read()
+
+    assert s == expected, \
+           f"Output '{s}' does not match contents of {result_file}\n"

{s} will be a multiline string here, better put it at the end: `Output does not match contents of {result_file}. Actual output: \n{s}`

-- 
Reply to this email directly or view it on GitHub:
https://github.com/osm2pgsql-dev/osm2pgsql/pull/2453#pullrequestreview-3764622873
You are receiving this because you are subscribed to this thread.

Message ID: <osm2pgsql-dev/osm2pgsql/pull/2453/review/3764622873 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20260206/2c486393/attachment-0001.htm>


More information about the Tile-serving mailing list