Closed StevenMaude closed 9 years ago
The biggest problem is with the Blob
class in sql.py. Several of the failures are due to sqlalchemy complaining that Blob object does not have the buffer interface
, related to Blob being a str which has changed from Python 2 to 3.
I fixed one of the failures. GitHub confuses me, so here's a git pull request.
The following changes since commit 45d21f32c3c351ef1f634dddfedff870a439814b:
Remove unneeded urllib2 from tests.py (2015-03-03 18:45:53 +0000)
are available in the git repository at:
git@github.com:tlevine/scraperwiki-python
for you to fetch changes up to 581c31f047ce1c24be795769f8809fcf9c2f8558:
expect bytes in STDOUT and STDERR rather than str (2015-03-03 19:19:20 +0000)
Thomas Levine (1): expect bytes in STDOUT and STDERR rather than str
tests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests.py b/tests.py index c21867e..9e2e1a2 100755 --- a/tests.py +++ b/tests.py @@ -237,8 +237,8 @@ class TestSaveColumn(TestCase): stdout=PIPE, stderr=PIPE, stdin=open("/dev/null")) stdout, stderr = process.communicate() assert process.returncode == 0
self.assertEqual(stderr, "".encode('utf-8'))
class TestSave(SaveAndCheck):
@tlevine Thanks, though I added it in by hand as the patch no longer applied as I'd made other changes.
(Also, I think the way to stick a pull request in for this case would have been: fork the current version of this repository, add commits to your copy of this branch, then pull request with base fork as this one, head fork as yours, both on the same branch.)
The main outstanding issue is related to SQLAlchemy is that the set_var()
and get_var()
tests fail in Python 3.4. Desired behaviour is that set_var()
stores Python data as binary along with the associated type in another column. get_var()
then converts that binary data back to the correct type in Python.
Fixing up the Blob
to use bytes
almost works, but the tests fail due to the data retrieved from get_var all being bytes
rather than the original type that was specified in the metadata column, e.g. int
: see my current version of sql.py
that I've been tweaking for Python 3.
This is all due to str
in Python 3 behaving like unicode
in Python 2, and bytes in Python 3 not being a direct substitute of str
. I'm not entirely sure how the magic conversion via SQLAlchemy works so don't know why this is failing.
Wonder if @pwaller or @drj11 have suggestions?
Closing, work carried on in #83.
Tests pass in Python 2.7.3 but get 2 failures and 7 errors at the moment with Python 3.4.3.