selftest: enable py3 for samba.tests.source
authorJoe Guo <joeg@catalyst.net.nz>
Thu, 5 Apr 2018 00:49:09 +0000 (12:49 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 13 Apr 2018 05:27:13 +0000 (07:27 +0200)
commitc07068038857bb93e3cf7f9f058054a3c9bda253
tree502671f0d24814aaba4d59103838202b47de766b
parenteec07f2fe5eab8046eed78c7c4439732f9f2118b
selftest: enable py3 for samba.tests.source

In py2, `open` has no `encoding` arg, python guesses file encoding from
locale. This could be wrong.

Use `io.open` to open a file, so we can specify encoding in both py2 and
py3.

Also, open file with `r` instead of `rb` for py3.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/source.py
selftest/tests.py