Files
sqlalchemy/test/conftest.py
T
Mike Bayer aba3ab247d after all that, use pytest warnings plugin
The warnings plugin lets us set the filters up
in the config, and as our filter requirements are now
simple we can just set this up.

additionally pytest now recommends pyproject.toml, since
we fully include this now, let's move it there.

the pytest logging plugin seems to not be any problem either
at the moment, so re-enable that.  if it becomes apparent
whatever the problem was (which was probably that it was just
surprising, or something) we can disable it again and comment
what the reason was.

Change-Id: Ia9715533b01f72aa5fdcf6a27ce75b76f829fa43
2022-01-23 12:58:38 -05:00

52 lines
1.3 KiB
Python
Executable File

#!/usr/bin/env python
"""
pytest plugin script.
This script is an extension to pytest which
installs SQLAlchemy's testing plugin into the local environment.
"""
import os
import sys
import pytest
os.environ["SQLALCHEMY_WARN_20"] = "true"
collect_ignore_glob = []
# this requires that sqlalchemy.testing was not already
# imported in order to work
pytest.register_assert_rewrite("sqlalchemy.testing.assertions")
if not sys.flags.no_user_site:
# this is needed so that test scenarios like "python setup.py test"
# work correctly, as well as plain "pytest". These commands assume
# that the package in question is locally present, but since we have
# ./lib/, we need to punch that in.
# We check no_user_site to honor the use of this flag.
sys.path.insert(
0,
os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "lib"),
)
# use bootstrapping so that test plugins are loaded
# without touching the main library before coverage starts
bootstrap_file = os.path.join(
os.path.dirname(__file__),
"..",
"lib",
"sqlalchemy",
"testing",
"plugin",
"bootstrap.py",
)
with open(bootstrap_file) as f:
code = compile(f.read(), "bootstrap.py", "exec")
to_bootstrap = "pytest"
exec(code, globals(), locals())
from sqla_pytestplugin import * # noqa