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
5 changes: 4 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ CHANGELOG
2.101.1+dev (XXXX-XX-XX)
------------------------

**Improvements**

- Add debug log to `reorder_topologies` command

2.101.1 (2023-10-06)
------------------------

**Bug fixes**

- POI cirkwi XML endpoint is fixed (2.101.0 regression) (#3783)


2.101.0 (2023-10-05)
------------------------

Expand Down
3 changes: 2 additions & 1 deletion geotrek/core/management/commands/reorder_topologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ def handle(self, *args, **options):
""")
points = cursor.fetchall()
id_order = 0

if options['verbosity']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je te conseille de regarder comment appeler la commande avec la verbosité dans les tests pour faire sauter le warning du code coverage -> https://docs.djangoproject.com/en/3.2/ref/django-admin/#running-management-commands-from-your-code

Je crois qu'il faudrait déclarer cette nouvelle option verbosity dans le parsing de la commande.

self.stdout.write(f'Processing topology : {topology.pk}')
dict_points = {}
for id_pa_point, geom_point_wkt in points:
dict_points[id_pa_point] = GEOSGeometry(geom_point_wkt, srid=settings.SRID)
Expand Down
2 changes: 1 addition & 1 deletion geotrek/core/tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def test_split_reorder_1(self):
[0, 0, 1])
output = StringIO()
call_command('reorder_topologies', stdout=output)
self.assertEqual('1 topologies has beeen updated\n', output.getvalue())
self.assertEqual(f'Processing topology : {topo.pk}\n1 topologies has beeen updated\n', output.getvalue())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plutôt que de dépendre d'un debug log dans les tests je te propose d'utiliser une regexp :

self.assertIsNotNone(re.search(r"1 topologies has beeen updated", output.getvalue())

geometries = self.get_geometries(topo)
self.assertEqual(geometries, [LineString((700000, 6600000), (700045, 6600045), srid=2154),
LineString((700045, 6600045), (700050, 6600050), srid=2154),
Expand Down