Note that this does _not_ demonstrate or test for full 8-bit transparency across implementations. (beanstalkc-to-beanstalkc could still easily pass this by using a fully revertible internal encoding.) However, this example should already be sufficient to illustrate a design issue for beanstalkc Python 3 adaptations. It should also be a good additional sanity check (even when ignoring 8-bit transparency), as the length of the job data in Unicode codepoints no longer equals the length in bytes after encoding via e.g. UTF-8: >>> data = '\x00\x01\xfe\xff' >>> len(data) 4 >>> len(data.encode('utf-8')) 6
- Use print(), not print - Use IGNORE_EXCEPTION_DETAIL to make exception testing tests not fail. In python 3, you would see 'beanstalkc.CommandFailed' instead of 'CommandFailed', this option makes tests pass regardless. Tested with python 2.7 and python3.
Not using the 'as' syntax, but calls to sys.exc_info is compatible with python 2.4 and newer (maybe older as well, but I don't have one available for testing). Tested on 2.4, 2.7 and 3.4.
Our testsuite tests features only available with beanstalkd 1.8+. To make this dependency explicit, we now build beanstalkd from source on Travis CI instead of relying on on distro-provided packages.