Skip to content

Conversation

@Chatewgne
Copy link
Contributor

@Chatewgne Chatewgne commented Oct 6, 2023

Make command easier to debug

Related Issue

Checklist

@Chatewgne Chatewgne force-pushed the impr_reorder_topologies_log branch from ef0dea6 to aea3cf3 Compare October 6, 2023 10:36
@Chatewgne Chatewgne changed the title Add debug log to reorder_topologies command 💫 [IMPR] Add debug log to reorder_topologies command Oct 6, 2023
@Chatewgne Chatewgne changed the title 💫 [IMPR] Add debug log to reorder_topologies command Add debug log to reorder_topologies command Oct 6, 2023
@cypress
Copy link

cypress bot commented Oct 6, 2023

Passing run #7421 ↗︎

0 24 0 0 Flakiness 0

Details:

Merge 5aa1bff into aa2fae5...
Project: Geotrek-admin Commit: 4843b3b42c ℹ️
Status: Passed Duration: 03:55 💡
Started: Oct 10, 2023 8:31 AM Ended: Oct 10, 2023 8:35 AM

Review all test suite changes for PR #3785 ↗︎

@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (aa2fae5) 98.32% compared to head (5aa1bff) 98.32%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3785   +/-   ##
=======================================
  Coverage   98.32%   98.32%           
=======================================
  Files         292      292           
  Lines       21818    21820    +2     
=======================================
+ Hits        21453    21455    +2     
  Misses        365      365           
Files Coverage Δ
...rek/core/management/commands/reorder_topologies.py 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Chatewgne Chatewgne force-pushed the impr_reorder_topologies_log branch from aea3cf3 to ee9b6fe Compare October 6, 2023 12:17
@Chatewgne Chatewgne force-pushed the impr_reorder_topologies_log branch from ee9b6fe to 5aa1bff Compare October 10, 2023 08:16
@Chatewgne Chatewgne requested a review from a team October 10, 2023 08:17
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())

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants