2
votes

I am taking the MongoDB for Python Developers course at Mongo University but I have this problem when trying to run pytest -m connection on a computer mac:

tests/test_db_connection.py EEEE [100%]

=========================================================== ERRORS =========================================================== _____________________________________________ ERROR at setup of test_atlas_setup _____________________________________________

request = > monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c838cd0>

@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 AttributeError: 'SubRequest' object has no attribute 'getfuncargvalue'

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytest_flask/plugin.py:109: AttributeError ____________________________________________ ERROR at setup of test_basic_movies _____________________________________________

request = > monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c893610>

@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 AttributeError: 'SubRequest' object has no attribute 'getfuncargvalue'

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytest_flask/plugin.py:109: AttributeError _________________________________________ ERROR at setup of test_search_by_movie_id __________________________________________

request = > monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c87c750>

@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 AttributeError: 'SubRequest' object has no attribute 'getfuncargvalue'

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytest_flask/plugin.py:109: AttributeError _________________________________________ ERROR at setup of test_simple_text_search __________________________________________

request = > monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x10c838ed0>

@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 AttributeError: 'SubRequest' object has no attribute 'getfuncargvalue'

/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pytest_flask/plugin.py:109: AttributeError

3

3 Answers

2
votes

From your error messages, you are using Python3.7.

It is possible that you are using the deprecated getfuncargvalue instead of getfixturevalue as described here.

0
votes

Try to update the dependencies of the project, the default dependencies of Pytest, pymongo and Flask are quite old. I managed to get the tests passing after updating them.

0
votes

Same happened to me. I added attrs==19.1.0 to requirements.txt and it worked!