Skip to content

Commit 740d4f1

Browse files
test: skip database tests based on TEST_DB environment variable (#4250)
* test: skip database tests based on TEST_DB environment variable * chore: adding changelog file 4250.test.md [dependabot-skip] --------- Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com>
1 parent edbda3b commit 740d4f1

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

doc/changelog.d/4250.test.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Skip database tests based on TEST_DB environment variable

tests/test_database.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
# SOFTWARE.
2222

23+
import os
2324
import re
2425

2526
from ansys.tools.versioning import server_meets_version
@@ -34,6 +35,8 @@
3435

3536
SKIP_ON_VERSIONS = ["22.2", "23.1", "23.2", "24.1", "24.2", "25.1", "25.2"]
3637

38+
TEST_DB = os.getenv("TEST_DB", "false").lower() == "true"
39+
3740

3841
@pytest.fixture(scope="session")
3942
def db(mapdl):
@@ -62,6 +65,9 @@ def db(mapdl):
6265
f"This version of MAPDL gRPC API version ('ansys.api.mapdl' == {ver_}) is not compatible with 'database' module."
6366
)
6467

68+
if not TEST_DB:
69+
pytest.skip("Database tests are skipped")
70+
6571
mapdl.clear()
6672
if mapdl.db.active or mapdl.db._stub is None:
6773
mapdl.db.stop()
@@ -94,6 +100,9 @@ def test_database_start_stop(mapdl, cleared):
94100
f"This MAPDL version ({mapdl_version}) docker image seems to not support DB, but local does."
95101
)
96102

103+
if not TEST_DB:
104+
pytest.skip("Database tests are skipped")
105+
97106
if MapdlDb(mapdl).active:
98107
MapdlDb(mapdl)._stop()
99108

0 commit comments

Comments
 (0)