Skip to content
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

Set the locale in the Docker image #173

Merged
merged 1 commit into from
Apr 8, 2021
Merged

Conversation

replaceafill
Copy link
Contributor

While preparing a few test transfers with non ascii paths I realized that if a feature file includes non ascii text the make test-at-behave rule of the development environment currently fails like this:

    Given a "standard" transfer type located in "Exception UnicodeEncodeError: 'ascii' codec can't encode characters in position 23-28: ordinal not in range(128)
Traceback (most recent call last):
  File "/usr/local/bin/behave", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/behave/__main__.py", line 183, in main
    return run_behave(config)
  File "/usr/local/lib/python3.6/dist-packages/behave/__main__.py", line 127, in run_behave
    failed = runner.run()
  File "/usr/local/lib/python3.6/dist-packages/behave/runner.py", line 804, in run
    return self.run_with_paths()
  File "/usr/local/lib/python3.6/dist-packages/behave/runner.py", line 824, in run_with_paths
    return self.run_model()
  File "/usr/local/lib/python3.6/dist-packages/behave/runner.py", line 626, in run_model
    failed = feature.run(self)
  File "/usr/local/lib/python3.6/dist-packages/behave/model.py", line 321, in run
    failed = scenario.run(runner)
  File "/usr/local/lib/python3.6/dist-packages/behave/model.py", line 1114, in run
    failed = scenario.run(runner)
  File "/usr/local/lib/python3.6/dist-packages/behave/model.py", line 711, in run
    if not step.run(runner):
  File "/usr/local/lib/python3.6/dist-packages/behave/model.py", line 1311, in run
    formatter.match(match)
  File "/usr/local/lib/python3.6/dist-packages/behave/formatter/pretty.py", line 132, in match
    self._match.location, self.monochrome)
  File "/usr/local/lib/python3.6/dist-packages/behave/formatter/pretty.py", line 301, in print_step
    self.stream.write(arg_format.text(arg.original))
UnicodeEncodeError: 'ascii' codec can't encode characters in position 23-28: ordinal not in range(128)

This fixes it by installing the locales package and generating the en_US.UTF-8 locale in the Docker image which is the same approach we use in the hack/Dockerfile.

Connected to archivematica/Issues#1317

@replaceafill replaceafill requested a review from a team April 8, 2021 00:50
@replaceafill replaceafill merged commit fed8e1f into qa/1.x Apr 8, 2021
@replaceafill replaceafill deleted the dev/issue-1317-set-locale branch April 8, 2021 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants