Issue with Unicode characters in the test description
With some setups when the test description (after the $
) contains Unicode characters (such as accents), should.py
fails with the following error:
Traceback (most recent call last):
File "should.py", line 1151, in <module>
status = fs.test(variables = variables, cd = args.cd, cd_same = args.cd_same, output = args.output, verbose = args.verbose, only = only)
File "should.py", line 1024, in test
s.test(open(f), variables, verbose - 1, only=only)
File "should.py", line 735, in test
for l in list(should_lines) + [DIRECTIVE_SCRIPT]:
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)
For instance it fails with Debian docker images (Debian 7, 8 or 9, but not with version 10).
Here is a Dockerfile to reproduce the bug:
from debian:9-slim
run apt-get update && apt-get install -y python3 wget
run wget -O should.py https://gitlab.bioinfo-diag.fr/vidjil/should/raw/master/src/should.py?inline=false
run echo 'ls should.py\n\n$ ÉÀ\n1:should.py' > test.should
And then
# Build the image
docker build -t should/issue:47 - < Dockerfile
# Launch the test
docker run should/issue:47 python3 should.py test.should
This script is used with CI which can rely on such Debian images.
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information