Merge branch 'more-test-fixes'. Fixes #144 which acutally was just a testing issue
commit
55c9b44c23
|
|
@ -8,7 +8,7 @@
|
|||
.. image:: https://img.shields.io/coveralls/baztian/jaydebeapi/master.svg
|
||||
:target: https://coveralls.io/r/baztian/jaydebeapi
|
||||
|
||||
.. image:: https://img.shields.io/badge/python-2.7,_3.4,_3.6-blue.svg
|
||||
.. image:: https://img.shields.io/badge/python-2.7,_3.5,_3.6-blue.svg
|
||||
:target: https://pypi.python.org/pypi/JayDeBeApi/
|
||||
|
||||
.. image:: https://img.shields.io/badge/jython-2.7.2-blue.svg
|
||||
|
|
@ -96,7 +96,7 @@ Here is an example:
|
|||
>>> curs = conn.cursor()
|
||||
>>> curs.execute('create table CUSTOMER'
|
||||
... '("CUST_ID" INTEGER not null,'
|
||||
... ' "NAME" VARCHAR not null,'
|
||||
... ' "NAME" VARCHAR(50) not null,'
|
||||
... ' primary key ("CUST_ID"))'
|
||||
... )
|
||||
>>> curs.execute("insert into CUSTOMER values (1, 'John')")
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-inline</artifactId>
|
||||
<version>3.3.3</version>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.10.19</version>
|
||||
<!-- non-test scope on purpose -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -207,17 +207,6 @@ class IntegrationTestBase(object):
|
|||
cursor.execute("select * from ACCOUNT")
|
||||
self.assertEqual(cursor.rowcount, -1)
|
||||
|
||||
def test_connection_with_statement(self):
|
||||
with self.connect() as conn:
|
||||
self.assertEqual(conn._closed, False)
|
||||
self.assertEqual(conn._closed, True)
|
||||
|
||||
def test_cursor_with_statement(self):
|
||||
with self.conn.cursor() as cursor:
|
||||
cursor.execute("select 1 from ACCOUNT")
|
||||
self.assertIsNotNone(cursor._connection)
|
||||
self.assertIsNone(cursor._connection)
|
||||
|
||||
class SqliteTestBase(IntegrationTestBase):
|
||||
|
||||
def setUpSql(self):
|
||||
|
|
@ -293,10 +282,12 @@ class PropertiesDriverArgsPassingTest(unittest.TestCase):
|
|||
driver, url, driver_args = ( 'org.hsqldb.jdbcDriver',
|
||||
'jdbc:hsqldb:mem:.',
|
||||
['SA', ''] )
|
||||
jaydebeapi.connect(driver, url, driver_args)
|
||||
c = jaydebeapi.connect(driver, url, driver_args)
|
||||
c.close()
|
||||
|
||||
def test_connect_with_properties(self):
|
||||
driver, url, driver_args = ( 'org.hsqldb.jdbcDriver',
|
||||
'jdbc:hsqldb:mem:.',
|
||||
{'user': 'SA', 'password': '' } )
|
||||
jaydebeapi.connect(driver, url, driver_args)
|
||||
c = jaydebeapi.connect(driver, url, driver_args)
|
||||
c.close()
|
||||
|
|
|
|||
|
|
@ -106,3 +106,16 @@ class MockTest(unittest.TestCase):
|
|||
self.fail("expected exception")
|
||||
except jaydebeapi.InterfaceError as e:
|
||||
self.assertEquals(str(e), "java.lang.RuntimeException: expected")
|
||||
|
||||
def test_cursor_with_statement(self):
|
||||
self.conn.jconn.mockType("INTEGER")
|
||||
with self.conn.cursor() as cursor:
|
||||
cursor.execute("dummy stmt")
|
||||
self.assertIsNotNone(cursor._connection)
|
||||
self.assertIsNone(cursor._connection)
|
||||
|
||||
def test_connection_with_statement(self):
|
||||
with jaydebeapi.connect('org.jaydebeapi.mockdriver.MockDriver',
|
||||
'jdbc:jaydebeapi://dummyurl') as conn:
|
||||
self.assertEqual(conn._closed, False)
|
||||
self.assertEqual(conn._closed, True)
|
||||
|
|
|
|||
2
tox.ini
2
tox.ini
|
|
@ -14,7 +14,7 @@ whitelist_externals = mvn
|
|||
setenv =
|
||||
CLASSPATH = {envdir}/javalib/*
|
||||
driver-mock: TESTNAME=test_mock
|
||||
driver-hsqldb: TESTNAME=test_integration.HsqldbTest
|
||||
driver-hsqldb: TESTNAME=test_integration.HsqldbTest test_integration.PropertiesDriverArgsPassingTest
|
||||
driver-sqliteXerial: TESTNAME=test_integration.SqliteXerialTest
|
||||
driver-sqlitePy: TESTNAME=test_integration.SqlitePyTest
|
||||
deps =
|
||||
|
|
|
|||
Loading…
Reference in New Issue