-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate evaluation state names in log display #2071
Translate evaluation state names in log display #2071
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me -- it would be nice if you could add a small test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the label "State" is not yet translated in the log, although I don't know why. Can you take a look at this?
Ah. I forgot to add that a pipeline fail caused by this would be expected, as we already discovered that "State" (capitalized) would still have to be (fuzzy) translated by you(?). |
Co-authored-by: Richard Ebeling <[email protected]>
I cannot attend in-person today. But hopefully it should now be ready for the final review :) @richardebeling edit: nvm, for some reason overriding the language works different in the ci? (all 575 pass locally) |
The issue was with the path that you patched -- see the Where to patch? part of the documentation for more details. In short, if a name is already imported in some location, patching the source-location afterwards doesn't work. For your test, it should work if you patch the name @patch("evap.evaluation.models._", new=(lambda string: "vorbereitet" if string == "prepared" else string))
def test_state_change_log_translated(self):
log_ul = self.app.get(self.url, user=self.manager).html.find(class_="list-group")
self.assertNotIn("vorbereitet", str(log_ul))
self.evaluation.ready_for_editors()
self.evaluation.save()
log_ul = self.app.get(self.url, user=self.manager).html.find(class_="list-group")
self.assertIn("vorbereitet", str(log_ul)) To get the same behavior locally as with the CI run, you can simply |
When executing just this single test, it does not pass for me if |
Ah, sorry. When we moved the Moving the My concern before, when I asked you to write a test, was that the code could (in future) not call @patch.dict(Evaluation.STATE_STR_CONVERSION, {Evaluation.State.PREPARED: "mock-translated-prepared"})
def test_state_change_log_translated(self):
log_ul = self.app.get(self.url, user=self.manager).html.find(class_="list-group")
self.assertNotIn("mock-translated-prepared", str(log_ul))
self.evaluation.ready_for_editors()
self.evaluation.save()
log_ul = self.app.get(self.url, user=self.manager).html.find(class_="list-group")
self.assertIn("mock-translated-prepared", str(log_ul)) |
5f60c70
to
1883356
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
This closes #1693.