diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-07-10 00:12:50 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2010-07-10 00:12:50 +0100 |
commit | deb2d9050fe2bfb9cd96e8042161b3aeb9559a32 (patch) | |
tree | 63568b1c012711bf542de7c434a2acd8b6a4e4e1 /tests | |
parent | cb8128c6d4de239ed5f22c4047b0f2ba260be22b (diff) | |
download | psycopg2-deb2d9050fe2bfb9cd96e8042161b3aeb9559a32.tar.gz |
Exceptions raised by the columns iterator propagated.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_copy.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_copy.py b/tests/test_copy.py index 87a999f..19fabe1 100644 --- a/tests/test_copy.py +++ b/tests/test_copy.py @@ -71,6 +71,20 @@ class CopyTests(unittest.TestCase): curs.execute("select * from tcopy order by id") self.assertEqual([(i, None) for i in range(10)], curs.fetchall()) + def test_copy_from_cols_err(self): + curs = self.conn.cursor() + f = StringIO() + for i in xrange(10): + f.write("%s\n" % (i,)) + + f.seek(0) + def cols(): + raise ZeroDivisionError() + yield 'id' + + self.assertRaises(ZeroDivisionError, + curs.copy_from, MinimalRead(f), "tcopy", columns=cols()) + def test_copy_to(self): curs = self.conn.cursor() try: |