Connection string visible in UI, but connection unit test fails

I’m currently on Chapter 1: Driver Setup.

I’m asked to do unit test for connection and if it is OK, then inspect the status page and get provide connection status string.

Thing is… connection unit test is failing, but when looking at the status page, the string is there.

screenshot of status page (blured string to avoid spoilers :]): http://take.ms/eQLWs
Output of the unit test:
~/mongodb_uni/m220p/mflix-python
venv ❯ pytest -m connection
================================================================================ test session starts ================================================================================
platform darwin – Python 3.7.1, pytest-4.0.1, py-1.7.0, pluggy-0.8.0
rootdir: /Users/jp/mongodb_uni/m220p/mflix-python, inifile:
plugins: flask-0.10.0
collected 43 items / 39 deselected

tests/test_db_connection.py EEEE                                                                                                                                              [100%]

====================================================================================== ERRORS =======================================================================================
________________________________________________________________________ ERROR at setup of test_atlas_setup _________________________________________________________________________

request = <SubRequest '_configure_application' for <Function 'test_atlas_setup'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f322358>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')
E       _pytest.warning_types.RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: RemovedInPytest4Warning
________________________________________________________________________ ERROR at setup of test_basic_movies ________________________________________________________________________

request = <SubRequest '_configure_application' for <Function 'test_basic_movies'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f322320>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

request = <SubRequest '_configure_application' for <Function 'test_atlas_setup'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f322358>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')
E       _pytest.warning_types.RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: RemovedInPytest4Warning
_____________________________________________________________________ ERROR at setup of test_search_by_movie_id _____________________________________________________________________

request = <SubRequest '_configure_application' for <Function 'test_search_by_movie_id'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f3600f0>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: in _configure_application
    app = request.getfuncargvalue('app')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

request = <SubRequest '_configure_application' for <Function 'test_atlas_setup'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f322358>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')
E       _pytest.warning_types.RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: RemovedInPytest4Warning
_____________________________________________________________________ ERROR at setup of test_simple_text_search _____________________________________________________________________

request = <SubRequest '_configure_application' for <Function 'test_simple_text_search'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f36e5f8>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: in _configure_application
    app = request.getfuncargvalue('app')
venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: in _configure_application
    app = request.getfuncargvalue('app')
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

request = <SubRequest '_configure_application' for <Function 'test_atlas_setup'>>, monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10f322358>

    @pytest.fixture(autouse=True)
    def _configure_application(request, monkeypatch):
        """Use `pytest.mark.options` decorator to pass options to your application
        factory::

            @pytest.mark.options(debug=False)
            def test_something(app):
                assert not app.debug, 'the application works not in debug mode!'

        """
        if 'app' not in request.fixturenames:
            return

>       app = request.getfuncargvalue('app')
E       _pytest.warning_types.RemovedInPytest4Warning: getfuncargvalue is deprecated, use getfixturevalue

venv/lib/python3.7/site-packages/pytest_flask/plugin.py:109: RemovedInPytest4Warning
====================================================================== 39 deselected, 4 error in 0.18 seconds =======================================================================

Solved.

add pytest==3.3.2 to requirements.txt
then rerun pip install -r requirements.txt

Seems to be related to https://github.com/pytest-dev/pytest-factoryboy/issues/41

2 Likes