Skip to content

Commit fb83fd6

Browse files
committed
Fix #420: Tests fail when mongomock is installed
1 parent c6ce162 commit fb83fd6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/test_connection.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
from flask_mongoengine import MongoEngine, current_mongoengine_instance
1111

1212

13+
def is_mongo_mock_installed() -> bool:
14+
try:
15+
import mongomock.__version__ # noqa
16+
except ImportError:
17+
return False
18+
return True
19+
20+
1321
def test_connection__should_use_defaults__if_no_settings_provided(app):
1422
"""Make sure a simple connection to a standalone MongoDB works."""
1523
db = MongoEngine()
@@ -128,6 +136,9 @@ def test_connection__should_parse_host_uri__if_host_formatted_as_uri(
128136
assert connection.PORT == 27017
129137

130138

139+
@pytest.mark.skipif(
140+
is_mongo_mock_installed(), reason="This test require mongomock not exist"
141+
)
131142
@pytest.mark.parametrize(
132143
("config_extension"),
133144
[

0 commit comments

Comments
 (0)