Skip to content

Commit

Permalink
pretify decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
jettify committed Sep 29, 2015
1 parent 15abf63 commit f7886d2
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def fin():


def pytest_namespace():
return {'dsn_list': [sqlite, pg, mysql],
'pg': [pg], 'sqlite': [sqlite], 'mysql': [mysql]}
return {'dsn_list': [sqlite, pg],
'pg': pg, 'sqlite': sqlite, 'mysql': mysql}


@pytest.fixture
Expand Down
12 changes: 6 additions & 6 deletions tests/pep492/test_async_await.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_cursor(loop, conn, table):

async def go():
Expand All @@ -21,7 +21,7 @@ async def go():
loop.run_until_complete(go())


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_cursor_lightweight(loop, conn, table):

async def go():
Expand All @@ -38,7 +38,7 @@ async def go():
loop.run_until_complete(go())


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_cursor_awit(loop, conn, table):

async def go():
Expand All @@ -51,7 +51,7 @@ async def go():
loop.run_until_complete(go())


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_connection(loop, conn):

async def go():
Expand All @@ -64,7 +64,7 @@ async def go():
loop.run_until_complete(go())


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_pool_context_manager(loop, pool):
async def go():
assert not pool.closed
Expand All @@ -75,7 +75,7 @@ async def go():
loop.run_until_complete(go())


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_pool_context_manager2(loop, pool):
async def go():
async with await pool as conn:
Expand Down
20 changes: 10 additions & 10 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_connect(loop, conn):
assert not conn.closed


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_basic_cursor(conn):
cursor = yield from conn.cursor()
Expand All @@ -29,7 +29,7 @@ def test_basic_cursor(conn):
assert resp == 10


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_default_event_loop(loop, dsn):
asyncio.set_event_loop(loop)
Expand All @@ -38,15 +38,15 @@ def test_default_event_loop(loop, dsn):
yield from conn.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_close_twice(conn):
yield from conn.close()
yield from conn.close()
assert conn.closed


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_execute(conn):
cur = yield from conn.execute('SELECT 10;')
Expand All @@ -56,7 +56,7 @@ def test_execute(conn):
assert conn.closed


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_getinfo(conn):
data = yield from conn.getinfo(pyodbc.SQL_CREATE_TABLE)
Expand All @@ -66,7 +66,7 @@ def test_getinfo(conn):
assert data in (pg, sqlite, mysql)


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_output_conversion(conn, table):
def convert(value):
Expand All @@ -92,13 +92,13 @@ def convert(value):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_autocommit(loop, connection_maker):
conn = connection_maker(loop, autocommit=True)
assert conn.autocommit, True


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_rollback(conn):
assert not conn.autocommit
Expand All @@ -125,7 +125,7 @@ def test_rollback(conn):

@pytest.mark.skipif(not PY_341, reason="Python 3.3 doesnt support __del__ "
"calls from GC")
@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test___del__(loop, dsn, recwarn):
conn = yield from aioodbc.connect(dsn=dsn, loop=loop)
Expand All @@ -136,7 +136,7 @@ def test___del__(loop, dsn, recwarn):
gc.collect()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_custom_executor(loop, dsn, executor):
conn = yield from aioodbc.connect(dsn=dsn, executor=executor, loop=loop)
Expand Down
36 changes: 18 additions & 18 deletions tests/test_cursor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pyodbc import OperationalError


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_cursor(conn):
cur = yield from conn.cursor()
Expand All @@ -20,7 +20,7 @@ def test_cursor(conn):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_execute_on_closed_cursor(conn):
cur = yield from conn.cursor()
Expand All @@ -29,7 +29,7 @@ def test_execute_on_closed_cursor(conn):
yield from cur.execute('SELECT 1;')


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_close(conn):
cur = yield from conn.cursor()
Expand All @@ -39,7 +39,7 @@ def test_close(conn):
assert cur.closed


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_description(conn):
cur = yield from conn.cursor()
Expand All @@ -50,7 +50,7 @@ def test_description(conn):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_description_with_real_table(conn, table):
cur = yield from conn.cursor()
Expand All @@ -62,7 +62,7 @@ def test_description_with_real_table(conn, table):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_rowcount_with_table(conn, table):
cur = yield from conn.cursor()
Expand All @@ -76,7 +76,7 @@ def test_rowcount_with_table(conn, table):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_arraysize(conn):
cur = yield from conn.cursor()
Expand All @@ -86,7 +86,7 @@ def test_arraysize(conn):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_fetchall(conn, table):
cur = yield from conn.cursor()
Expand All @@ -100,7 +100,7 @@ def test_fetchall(conn, table):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_fetchmany(conn, table):
cur = yield from conn.cursor()
Expand All @@ -114,7 +114,7 @@ def test_fetchmany(conn, table):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_fetchone(conn, table):
cur = yield from conn.cursor()
Expand All @@ -126,7 +126,7 @@ def test_fetchone(conn, table):
yield from cur.close()


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_tables(conn, table):
cur = yield from conn.cursor()
Expand All @@ -137,7 +137,7 @@ def test_tables(conn, table):
assert expectd == tuple(resp[0]), resp


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_cursor_rollback(conn, table):

Expand All @@ -153,7 +153,7 @@ def test_cursor_rollback(conn, table):
assert value is None


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_columns(conn, table):
cur = yield from conn.cursor()
Expand All @@ -167,7 +167,7 @@ def test_columns(conn, table):
assert expectd == columns


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
@pytest.mark.run_loop
def test_executemany(conn):
cur = yield from conn.cursor()
Expand All @@ -189,7 +189,7 @@ def test_executemany(conn):
yield from cur.execute("DROP TABLE t1;")


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_procedures_empty(conn, table):
cur = yield from conn.cursor()
Expand All @@ -198,7 +198,7 @@ def test_procedures_empty(conn, table):
assert resp == []


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_procedureColumns_empty(conn, table):
cur = yield from conn.cursor()
Expand All @@ -207,7 +207,7 @@ def test_procedureColumns_empty(conn, table):
assert resp == []


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_primaryKeys_empty(conn, table):
cur = yield from conn.cursor()
Expand All @@ -216,7 +216,7 @@ def test_primaryKeys_empty(conn, table):
assert resp == []


@pytest.mark.parametrize("dsn", pytest.sqlite)
@pytest.mark.parametrize('dsn', [pytest.sqlite])
@pytest.mark.run_loop
def test_foreignKeys_empty(conn, table):
cur = yield from conn.cursor()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_create_pool2(loop, pool_maker, dsn):
assert 10 == pool.freesize


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_acquire(loop, pool):
@asyncio.coroutine
def go():
Expand Down Expand Up @@ -439,7 +439,7 @@ def go():
loop.run_until_complete(go())


@pytest.mark.parametrize("dsn", pytest.dsn_list)
@pytest.mark.parametrize('dsn', pytest.dsn_list)
def test_pool_with_executor(loop, pool_maker, dsn, executor):
pool = pool_maker(loop, executor=executor, dsn=dsn, minsize=2, maxsize=2)

Expand Down

0 comments on commit f7886d2

Please sign in to comment.