mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-02-17 01:20:32 +03:00
Remove io.TextIOBase workaround for Python <= 2.5
io.TextIOBase is available on all Python versions supported by psycopg2. Can remove all workarounds.
This commit is contained in:
parent
858bc3d42a
commit
f7d5d25651
|
@ -25,7 +25,7 @@
|
||||||
import sys
|
import sys
|
||||||
import string
|
import string
|
||||||
from testutils import (unittest, ConnectingTestCase, decorate_all_tests,
|
from testutils import (unittest, ConnectingTestCase, decorate_all_tests,
|
||||||
skip_if_no_iobase, skip_before_postgres, slow)
|
skip_before_postgres, slow)
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from itertools import cycle, izip
|
from itertools import cycle, izip
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import Popen, PIPE
|
||||||
|
@ -131,7 +131,6 @@ class CopyTests(ConnectingTestCase):
|
||||||
finally:
|
finally:
|
||||||
curs.close()
|
curs.close()
|
||||||
|
|
||||||
@skip_if_no_iobase
|
|
||||||
def test_copy_text(self):
|
def test_copy_text(self):
|
||||||
self.conn.set_client_encoding('latin1')
|
self.conn.set_client_encoding('latin1')
|
||||||
self._create_temp_table() # the above call closed the xn
|
self._create_temp_table() # the above call closed the xn
|
||||||
|
@ -154,7 +153,6 @@ class CopyTests(ConnectingTestCase):
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
self.assertEqual(f.readline().rstrip(), about)
|
self.assertEqual(f.readline().rstrip(), about)
|
||||||
|
|
||||||
@skip_if_no_iobase
|
|
||||||
def test_copy_bytes(self):
|
def test_copy_bytes(self):
|
||||||
self.conn.set_client_encoding('latin1')
|
self.conn.set_client_encoding('latin1')
|
||||||
self._create_temp_table() # the above call closed the xn
|
self._create_temp_table() # the above call closed the xn
|
||||||
|
@ -176,7 +174,6 @@ class CopyTests(ConnectingTestCase):
|
||||||
f.seek(0)
|
f.seek(0)
|
||||||
self.assertEqual(f.readline().rstrip(), about)
|
self.assertEqual(f.readline().rstrip(), about)
|
||||||
|
|
||||||
@skip_if_no_iobase
|
|
||||||
def test_copy_expert_textiobase(self):
|
def test_copy_expert_textiobase(self):
|
||||||
self.conn.set_client_encoding('latin1')
|
self.conn.set_client_encoding('latin1')
|
||||||
self._create_temp_table() # the above call closed the xn
|
self._create_temp_table() # the above call closed the xn
|
||||||
|
|
|
@ -261,20 +261,6 @@ def skip_if_no_namedtuple(f):
|
||||||
return skip_if_no_namedtuple_
|
return skip_if_no_namedtuple_
|
||||||
|
|
||||||
|
|
||||||
def skip_if_no_iobase(f):
|
|
||||||
"""Skip a test if io.TextIOBase is not available."""
|
|
||||||
@wraps(f)
|
|
||||||
def skip_if_no_iobase_(self):
|
|
||||||
try:
|
|
||||||
from io import TextIOBase # noqa
|
|
||||||
except ImportError:
|
|
||||||
return self.skipTest("io.TextIOBase not found.")
|
|
||||||
else:
|
|
||||||
return f(self)
|
|
||||||
|
|
||||||
return skip_if_no_iobase_
|
|
||||||
|
|
||||||
|
|
||||||
def skip_before_postgres(*ver):
|
def skip_before_postgres(*ver):
|
||||||
"""Skip a test on PostgreSQL before a certain version."""
|
"""Skip a test on PostgreSQL before a certain version."""
|
||||||
ver = ver + (0,) * (3 - len(ver))
|
ver = ver + (0,) * (3 - len(ver))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user