[0.8] VerifyTest fails with AttributeError ('bytes' object has no attribute 'encode'")
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Duplicity |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Using 0.8 r1377
$ cd /tmp
$ bzr branch lp:duplicity
$ cd duplicity
$ python3.7 setup.py build --force
$ PYTHONPATH=
(that's on an i386 chroot, path to adapt for amd64)
The tests have some errors, including that one
___________ VerifyTest.
self = <testing.
def test_verify_
u"""Test verify with --compare-data gives an error if a source file is changed"""
> self.backup(
functional/
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
functional/
result = self.run_
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <testing.
options = ['full', 'testfiles/
current_time = None, fail = None, passphrase_input = []
def run_duplicity(self, options=[], current_time=None, fail=None,
u"""
Run duplicity binary with given arguments and options
"""
# We run under setsid and take input from /dev/null (below) because
# this way we force a failure if duplicity tries to read from the
# console unexpectedly (like for gpg password or such).
# Check all string inputs are unicode -- we will convert to system encoding before running the command
for item in options:
if sys.version_
for item in passphrase_input:
assert isinstance(item, u"".__class__), u"item " + unicode(item) + u" in passphrase_input is not unicode"
if platform.
if self._setsid_w:
else:
if current_time:
if fail:
cmdline = u" ".join([u'"%s"' % x for x in cmd_list])
if not passphrase_input:
cmdline += u" < /dev/null"
# The immediately following block is the nicer way to execute pexpect with
# unicode strings, but we need to have the pre-4.0 version for some time yet,
# so for now this is commented out so tests execute the same way on all systems.
# if parse_version(
# # pexpect.spawn only supports unicode from version 4.0
# # there was a separate pexpect.spawnu in 3.x, but it has an error on readline
# child = pexpect.
#
# for passphrase in passphrase_input:
# child.expect(
# child.sendline(
# else:
# Manually encode to filesystem encoding and send to spawn as bytes
# ToDo: Remove this once we no longer have to support systems with pexpect < 4.0
if sys.version_
child = pexpect.
else:
child = pexpect.
for passphrase in passphrase_input:
# if the command fails, we need to clear its output
# so it will terminate cleanly.
lines = child.before.
return_val = child.exitstatus
if fail:
elif return_val:
for line in lines:
if line:
> raise CmdError(
E testing.
functional/
-------
...command: "setsid" "-w" "../bin/duplicity" "full" "testfiles/
...cwd: /build/
...output:
b'Traceback (innermost last):'
b' File "../bin/duplicity", line 1706, in <module>'
b' with_tempdir(main)'
b' File "../bin/duplicity", line 1692, in with_tempdir'
b' fn()'
b' File "../bin/duplicity", line 1538, in main'
b' do_backup(action)'
b' File "../bin/duplicity", line 1662, in do_backup'
b' full_backup(
b' File "../bin/duplicity", line 568, in full_backup'
b' globals.backend)'
b' File "../bin/duplicity", line 425, in write_multivol'
b' globals.volsize)'
b' File "/build/
b' data = block_iter.
b' File "/build/
b' result = self.process(
b' File "/build/
b' (new_path, sig_path, sigTarFile))'
b' File "/build/
b' return function(*args)'
b' File "/build/
b' sigTarFile.
b' File "/usr/lib/
b' buf = tarinfo.
b' File "/usr/lib/
b' return self.create_
b' File "/usr/lib/
b' return buf + self._create_
b' File "/usr/lib/
b' stn(info.
b' File "/usr/lib/
b' s = s.encode(encoding, errors)'
b" AttributeError: 'bytes' object has no attribute 'encode'"
...return_val: 30
summary: |
- [0.8] VerifyTest fails with AttributeError + [0.8] VerifyTest fails with AttributeError ('bytes' object has no + attribute 'encode'") |
Changed in duplicity: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
milestone: | none → 0.8.01 |
Changed in duplicity: | |
status: | Fix Committed → Fix Released |
Wrong Python version. You ran under py2.3, not 2.7. Python 2.7 is required for 0.8.00.