diff --git a/doc/changelog.d/4250.test.md b/doc/changelog.d/4250.test.md new file mode 100644 index 00000000000..30d1772c015 --- /dev/null +++ b/doc/changelog.d/4250.test.md @@ -0,0 +1 @@ +Skip database tests based on TEST_DB environment variable diff --git a/tests/test_database.py b/tests/test_database.py index 7cb8440eaea..8018d84df54 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -20,6 +20,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +import os import re from ansys.tools.versioning import server_meets_version @@ -34,6 +35,8 @@ SKIP_ON_VERSIONS = ["22.2", "23.1", "23.2", "24.1", "24.2", "25.1", "25.2"] +TEST_DB = os.getenv("TEST_DB", "false").lower() == "true" + @pytest.fixture(scope="session") def db(mapdl): @@ -62,6 +65,9 @@ def db(mapdl): f"This version of MAPDL gRPC API version ('ansys.api.mapdl' == {ver_}) is not compatible with 'database' module." ) + if not TEST_DB: + pytest.skip("Database tests are skipped") + mapdl.clear() if mapdl.db.active or mapdl.db._stub is None: mapdl.db.stop() @@ -94,6 +100,9 @@ def test_database_start_stop(mapdl, cleared): f"This MAPDL version ({mapdl_version}) docker image seems to not support DB, but local does." ) + if not TEST_DB: + pytest.skip("Database tests are skipped") + if MapdlDb(mapdl).active: MapdlDb(mapdl)._stop()