sqlalchemy / alembic

A database migrations tool for SQLAlchemy.
MIT License
2.61k stars 234 forks source link

test suite breaks in pytest 8.1 #1435

Closed zzzeek closed 4 months ago

zzzeek commented 4 months ago

teardown is not called

rm -fr scratch; PYTHONPATH=~/dev/sqlalchemy/lib/ pytest tests/test_command.py::HistoryTest

fails under pytest 8.1 only

FAILED tests/test_command.py::HistoryTest::test_history_num_plus_relative - AssertionError: 'environment included OK\nRev: dd711a17688e (head)\nParent: ab3d7d7d454d\nPath: /home/classic/dev/alembic/scratch/scripts/versions/dd711a17688e_revision_c.py\n\n  ...
FAILED tests/test_command.py::HistoryTest::test_history_num_range - AssertionError: 'environment included OK\nRev: ab3d7d7d454d\nParent: 642ae92838b4\nPath: /home/classic/dev/alembic/scratch/scripts/versions/ab3d7d7d454d_revision_b.py\n\n    Rev B...
FAILED tests/test_command.py::HistoryTest::test_history_num_to_head - AssertionError: 'environment included OK\nRev: dd711a17688e (head)\nParent: ab3d7d7d454d\nPath: /home/classic/dev/alembic/scratch/scripts/versions/dd711a17688e_revision_c.py\n\n  ...
FAILED tests/test_command.py::HistoryTest::test_history_relative_to_num - AssertionError: 'environment included OK\nRev: dd711a17688e (head)\nParent: ab3d7d7d454d\nPath: /home/classic/dev/alembic/scratch/scripts/versions/dd711a17688e_revision_c.py\n\n  ...
FAILED tests/test_command.py::HistoryTest::test_history_too_large_relative_to_num - AssertionError: 'environment included OK\nRev: dd711a17688e (head)\nParent: ab3d7d7d454d\nPath: /home/classic/dev/alembic/scratch/scripts/versions/dd711a17688e_revision_c.py\n\n  ...
zzzeek commented 4 months ago

https://docs.pytest.org/en/stable/deprecations.html#nose-deprecation

zzzeek commented 4 months ago

it was deprecated a year ago with no warnings, claimed to be removed in 8.0 but wasn't, but anyway, need to change the name

sqla-tester commented 4 months ago

Mike Bayer has proposed a fix for this issue in the main branch:

use SQLAlchemy's xdist methods https://gerrit.sqlalchemy.org/c/sqlalchemy/alembic/+/5177