]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
ceph-detect-init: fix the py3 test 10266/head
authorKefu Chai <kchai@redhat.com>
Tue, 12 Jul 2016 16:47:49 +0000 (00:47 +0800)
committerKefu Chai <kchai@redhat.com>
Tue, 12 Jul 2016 18:25:07 +0000 (02:25 +0800)
commit6ed1c41fede0a767adcf1ba53f2a57d94ec2fda9
tree2f4d03e3e9d9ba8c80713b32bdf6ab86473d7dde
parent4366145a09f109c86972014c945969036653eeaa
ceph-detect-init: fix the py3 test

the mock_open() does not support "for i in open()", and readline() and
readlines() support was added in py3.3 and py3.4 so for better backwards
compatibility, we should change the code being tested to use the plain
read() call.
and also use open(path) instead of open(path, 'rb') for simplicity,
otherwise we need to use bytestring for comparison and pass the same
parameters to mock.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/ceph-detect-init/ceph_detect_init/gentoo/__init__.py
src/ceph-detect-init/tests/test_all.py