Skip to content

Commit 0bc720d

Browse files
gordthompsonrafiss
authored andcommitted
Updates for current SQLAlchemy/Alembic versions
Alembic: Version 1.7 has been released so we no longer need to install from GitHub to have access to the test suite. SQLAlchemy: 2.0 deprecation warnings are now being emitted where they were previously being automatically suppressed. Adjust tests to avoid the warnings, so they do not cause the tests to fail.
1 parent afbbb5a commit 0bc720d

File tree

7 files changed

+9
-16
lines changed

7 files changed

+9
-16
lines changed

README.testing.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,7 @@ The minimum requirements for testing are:
2020

2121
Install them with
2222

23-
pip install sqlalchemy pytest psycopg2-binary
24-
25-
# A pre-release version of Alembic is required until version 1.7 is released.
26-
# (Bear this in mind if you rebuild test-requirements.txt via make.)
27-
pip install git+https://github.com/sqlalchemy/alembic
23+
pip install sqlalchemy alembic pytest psycopg2-binary
2824

2925
Then, to run a complete test simply invoke
3026

test-requirements.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# To add/update dependencies, update test-requirements.in (not the
55
# generated test-requirements.txt) and run make update-requirements
66

7-
# Remove this once alembic 1.7 has been released
8-
git+https://github.com/sqlalchemy/alembic
7+
alembic
98
futures
109
mock
1110
more-itertools

test-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
git+https://github.com/sqlalchemy/alembic
1+
alembic==1.7.0
22
# via -r test-requirements.in
33
attrs==21.2.0
44
# via pytest

test/test_aaa_run_transaction_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_balances(self, conn):
4747
"""Returns the balances of the two accounts as a list."""
4848
result = []
4949
query = (
50-
select([account_table.c.balance])
50+
select(account_table.c.balance)
5151
.where(account_table.c.acct.in_((1, 2)))
5252
.order_by(account_table.c.acct)
5353
)
@@ -96,7 +96,7 @@ def barrier():
9696
iters1,
9797
iters2,
9898
)
99-
balances = self.get_balances(testing.db)
99+
balances = self.get_balances(testing.db.connect())
100100
assert balances == [100, 100], (
101101
"expected balances to be restored without error; " "got %s" % balances
102102
)

test/test_aab_run_transaction_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def get_balances(self, conn):
3535
"""Returns the balances of the two accounts as a list."""
3636
result = []
3737
query = (
38-
select([account_table.c.balance])
38+
select(account_table.c.balance)
3939
.where(account_table.c.acct.in_((1, 2)))
4040
.order_by(account_table.c.acct)
4141
)
@@ -84,7 +84,7 @@ def barrier():
8484
iters1,
8585
iters2,
8686
)
87-
balances = self.get_balances(testing.db)
87+
balances = self.get_balances(testing.db.connect())
8888
assert balances == [100, 100], (
8989
"expected balances to be restored without error; " "got %s" % balances
9090
)

test/test_json.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ def test_json(self, connection):
3737
return
3838
json_table = self.tables.json_model
3939
result = []
40-
query = select(
41-
[json_table.c.jsonb_data, json_table.c.json_data, json_table.c.base_json_data]
42-
)
40+
query = select(json_table.c.jsonb_data, json_table.c.json_data, json_table.c.base_json_data)
4341
for row in connection.execute(query):
4442
result.append((row.jsonb_data, row.json_data, row.base_json_data))
4543
eq_(result, [({"a": 1}, {"b": 2}, {"c": 3}), ({"d": 4}, {"e": 5}, {"f": 6})])

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ envlist =
66

77
[testenv]
88
commands =
9-
python -m pytest {posargs}
9+
python -m pytest {posargs} test
1010
# For some reason pip fails to load the requirements file without this.
1111
setenv =
1212
LANG = en_US.utf-8

0 commit comments

Comments
 (0)