From d2815b4ac39b42a38dff4cc21ec100c72b9f3cae Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 4 Mar 2022 16:28:31 -0500 Subject: [PATCH] correct for pytest discovery Made corrections to the default pytest configuration so that test discovery runs correctly; previously, a configuration error had the effect of discovery locating the wrong files if a super-directory of the current directory were named "test". Fixes: #7045 Change-Id: I2e1f63a35f80ae3f53008f327d83c8342fa7f2f6 --- pyproject.toml | 3 ++- test/conftest.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index cefda245f7..963b546ed9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,8 @@ exclude-modules = '^sqlalchemy\.testing' [tool.pytest.ini_options] addopts = "--tb native -v -r sfxX --maxfail=250 -p warnings -p logging --strict-markers" -python_files = "test/*test_*.py" +norecursedirs = "examples build doc lib" +python_files = "test_*.py" minversion = "6.2" filterwarnings = [ # NOTE: additional SQLAlchemy specific filters in diff --git a/test/conftest.py b/test/conftest.py index d082f44a19..b7f2d945ca 100755 --- a/test/conftest.py +++ b/test/conftest.py @@ -29,7 +29,11 @@ if not sys.flags.no_user_site: # 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"), + os.path.abspath( + os.path.join( + os.path.dirname(os.path.abspath(__file__)), "..", "lib" + ) + ), ) # use bootstrapping so that test plugins are loaded -- 2.47.2