diff options
| author | Victor Stinner <vstinner@redhat.com> | 2015-04-10 12:35:31 +0200 |
|---|---|---|
| committer | Kevin Greenan <kmgreen2@gmail.com> | 2015-07-20 22:47:51 -0700 |
| commit | 5526559bfa54488357c17f52720d9715bb0abec3 (patch) | |
| tree | c97d20a2e7bc32e97b1f97261cd2d15142ab995b /test | |
| parent | cf04d34162c377c9ae08d49abacd6f23dd9e1430 (diff) | |
| download | pyeclib-5526559bfa54488357c17f52720d9715bb0abec3.tar.gz | |
Merging Victor's commit into our handful of 1.0.8 commits.merge_python3_stuff
Fix Python 3 issues
* Use relative imports
* Fix bytes/unicode issues in tests
Conflicts:
pyeclib/core.py
test/test_pyeclib_api.py
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_pyeclib_api.py | 4 | ||||
| -rw-r--r-- | test/test_pyeclib_c.py | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/test/test_pyeclib_api.py b/test/test_pyeclib_api.py index 21ebed6..c084f70 100644 --- a/test/test_pyeclib_api.py +++ b/test/test_pyeclib_api.py @@ -93,8 +93,10 @@ class TestPyECLibDriver(unittest.TestCase): # Create the dictionary of files to test with buf = ''.join(random.choice(ascii_letters) for i in range(size)) + if sys.version_info >= (3,): + buf = buf.encode('ascii') tmp_file = tempfile.NamedTemporaryFile() - tmp_file.write(buf.decode('utf-8')) + tmp_file.write(buf) self.files[size_str] = tmp_file def setUp(self): diff --git a/test/test_pyeclib_c.py b/test/test_pyeclib_c.py index 9827fd3..24440cd 100644 --- a/test/test_pyeclib_c.py +++ b/test/test_pyeclib_c.py @@ -23,6 +23,7 @@ import random from string import ascii_letters +import sys import tempfile import time import unittest @@ -111,8 +112,10 @@ class TestPyECLib(unittest.TestCase): # Create the dictionary of files to test with buf = ''.join(random.choice(ascii_letters) for i in range(size)) - tmp_file = tempfile.NamedTemporaryFile() - tmp_file.write(buf.decode('utf-8')) + if sys.version_info >= (3,): + buf = buf.encode('ascii') + tmp_file = tempfile.NamedTemporaryFile('w+b') + tmp_file.write(buf) self.files[size_str] = tmp_file def get_tmp_file(self, name): |
