<p></p>
<p><b>@joto</b> commented on this pull request.</p>

<p dir="auto">I needed <code class="notranslate">tests/bdd/steps/__pycache__</code> in .gitignore. The <code class="notranslate">tests/__pycache__</code> can be removed I think.</p>
<p dir="auto">The <code class="notranslate">test/bdd</code> directory contains the tests themselves (<code class="notranslate">flex</code>, <code class="notranslate">parameters</code>, <code class="notranslate">regression</code>) as well as the "infrastructure" (<code class="notranslate">environment.py</code>, <code class="notranslate">steps</code>) which I find slightly confusing. Also <code class="notranslate">parameters</code> is very general, maybe <code class="notranslate">command-line</code> or so?</p>
<p dir="auto">There are several tests with a single input node that is just there so that <em>some</em> data is imported, it isn't checked what. Does it make sense to special case this somehow?</p><hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1670#discussion_r867980525">CONTRIBUTING.md</a>:</p>
<pre style='color:#555'>> +```
+
+There are ctest directives to run the tests. If you want to run the tests
+manually, for example to run single tests during development, you can
+switch to the bdd test directory and run behave directly from there:
+
+```sh
+cd osm2pgsql/tests/bdd
+behave -DBINARY=<your build directory>/osm2pgsql
+```
+
+Per default, behave assumes that the build directory is under `osm2pgsql/build`.
+If your setup works like that, you can leave out the -D parameter.
+
+To run a single test, simply add the name of the test file, followed by a
+column an the line number of the test:
</pre>
<p dir="auto">column an<em>d</em></p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1670#discussion_r867981060">CONTRIBUTING.md</a>:</p>
<pre style='color:#555'>> +behave -DBINARY=<your build directory>/osm2pgsql
+```
+
+Per default, behave assumes that the build directory is under `osm2pgsql/build`.
+If your setup works like that, you can leave out the -D parameter.
+
+To run a single test, simply add the name of the test file, followed by a
+column an the line number of the test:
+
+```sh
+behave flex/area.feature:71
+```
+
+If you need to inspect the database that a test produces, you can add
+`-DKEEP_TEST_DB` and behave won't remove the database after the test is
+finished. This makes of course only sense, when running a sinlge test.
</pre>
<p dir="auto">...sin<em>gl</em>e test</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1670#discussion_r867989000">tests/bdd/parameters/dsn.feature</a>:</p>
<pre style='color:#555'>> +
+    Scenario Outline:
+        Given the OSM data
+            """
+            n34 Tamenity=restaurant x77 y45.3
+            """
+
+        When running osm2pgsql pgsql with parameters
+            | -d |
+            | <connection_parameter> |
+
+        Then table planet_osm_point has 1 row
+
+        Examples:
+            | connection_parameter    |
+            | {TEST_DB} |
</pre>
<p dir="auto">Add spaces for consistency with other tables.</p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1670#discussion_r867993111">tests/bdd/environment.py</a>:</p>
<pre style='color:#555'>> +#    behave -DBINARY=/tmp/my-builddir/osm2pgsql -DKEEP_TEST_DB
+USER_CONFIG = {
+    'BINARY': (TEST_BASE_DIR / '..' / 'build' / 'osm2pgsql').resolve(),
+    'TEST_DATA_DIR': TEST_BASE_DIR / 'data',
+    'SRC_DIR': (TEST_BASE_DIR / '..').resolve(),
+    'KEEP_TEST_DB': False,
+    'TEST_DB': 'osm2pgsql-test',
+    'HAVE_TABLESPACE': True,
+    'HAVE_LUA': True,
+    'HAVE_PROJ': True
+}
+
+use_step_matcher('re')
+
+def _connect_db(context, dbname):
+    """ Connect to the given database and return the conntection
</pre>
<p dir="auto"><code class="notranslate">conn**ection</code></p>

<hr>

<p>In <a href="https://github.com/openstreetmap/osm2pgsql/pull/1670#discussion_r868013502">tests/bdd/steps/geometry_factory.py</a>:</p>
<pre style='color:#555'>> +                 Line geometry
+              (<P>,...,<P>)
+                 Polygon geometry
+
+           <P> may either be a coordinate of the form '<x> <y>' or a single
+           number. In the latter case it must refer to a point in
+           a previously defined grid.
+        """
+        if geom.find(',') < 0:
+            out = "POINT({})".format(self.mk_wkt_point(geom))
+        elif geom.find('(') < 0:
+            out = "LINESTRING({})".format(self.mk_wkt_points(geom))
+        else:
+            out = "POLYGON(({}))".format(self.mk_wkt_points(geom.strip('() ')))
+
+        return "ST_SetSRID('{}'::geometry, 4326)".format(out)
</pre>
<p dir="auto">Use EWKT format <code class="notranslate">SRID=4326;POLYGON((0 0,0 1,1 1,1 0,0 0))</code> instead of the <code class="notranslate">ST_SetSRID()</code>?</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/osm2pgsql/pull/1670#pullrequestreview-966081930">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AA6353QWXMFF74L2F23XQKDVJEHOVANCNFSM5UI3RVMA">unsubscribe</a>.<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AA6353X4SJ6EEJNRGNSDOZLVJEHOVA5CNFSM5UI3RVMKYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOHGKT3CQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/osm2pgsql/pull/1670/review/966081930</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/osm2pgsql/pull/1670#pullrequestreview-966081930",
"url": "https://github.com/openstreetmap/osm2pgsql/pull/1670#pullrequestreview-966081930",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>