Pytest -m connection failes!

================================================= test session starts =================================================
platform win32 -- Python 3.8.2, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python, inifile: pytest.ini
collected 43 items / 39 deselected / 4 selected

tests\test_db_connection.py EEEE                                                                                 [100%]

======================================================= ERRORS ========================================================
_________________________________________ ERROR at setup of test_atlas_setup __________________________________________
file C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py, line 21
  @pytest.mark.connection
  @pytest.mark.usefixtures('config')
  def test_atlas_setup(client, config):
E       fixture 'config' not found
>       available fixtures: app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py:21
_________________________________________ ERROR at setup of test_basic_movies _________________________________________
file C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py, line 29
  @pytest.mark.connection
  def test_basic_movies(client):
E       fixture 'client' not found
>       available fixtures: app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py:29
______________________________________ ERROR at setup of test_search_by_movie_id ______________________________________
file C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py, line 36
  @pytest.mark.connection
  def test_search_by_movie_id(client):
E       fixture 'client' not found
>       available fixtures: app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py:36
______________________________________ ERROR at setup of test_simple_text_search ______________________________________
file C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py, line 42
  @pytest.mark.connection
  def test_simple_text_search(client):
E       fixture 'client' not found
>       available fixtures: app, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.

C:\Users\Infogen\Desktop\Learn\mongodbuniversity\mflix-python\tests\test_db_connection.py:42
=============================================== short test summary info ===============================================
ERROR tests/test_db_connection.py::test_atlas_setup
ERROR tests/test_db_connection.py::test_basic_movies
ERROR tests/test_db_connection.py::test_search_by_movie_id
ERROR tests/test_db_connection.py::test_simple_text_search
========================================== 39 deselected, 4 errors in 0.23s ===========================================

Rather than dump lines of errors, suggest you include an explanation. This is a discussion board afterall.

Hi @Ajinkya_12068,

I found this below post:

Let me know if this helps.

Kanika

I have been going in troubleshooting circles for about two days and am out of ideas. I’m posting here because the end result is the error about “fixture ‘config’ not found”. Below are the steps I am doing:

1 - I run the initial “pip install -r .\requirements.txt” but I added --user at the end because I got an error about not being able to uninstall a terminado package due to it being a distutils project. So “pip install -r .\requirements.txt --user”

2- This runs successfully except one part:

Requirement already satisfied: pywinpty>=0.5; os_name == “nt” in c:\programdata\anaconda3\lib\site-packages (from terminado==0.8.2->-r .\requirements.txt (line 62)) (0.5.7)
ERROR: -ytest-astropy 0.8.0 has requirement pytest>=4.6, but you’ll have pytest 3.3.0 which is incompatible.
ERROR: spyder 4.0.1 has requirement jedi==0.14.1, but you’ll have jedi 0.15.1 which is incompatible.
ERROR: spyder 4.0.1 has requirement qtconsole>=4.6.0, but you’ll have qtconsole 4.5.5 which is incompatible.
ERROR: pytest-cov 2.9.0 has requirement pytest>=3.6, but you’ll have pytest 3.3.0 which is incompatible.

3 - At this point I try to run “pytest -m connection”. The output ends with “pluggy.PluginValidationError: Plugin ‘pytest_cov’ could not be loaded: (pytest 3.3.0 (c:\users\doob1\appdata\roaming\python\python37\site-packages), Requirement.parse(‘pytest>=3.6’))!”

4 - Now I begin a tedious adventure of upgrading various pip packages until I arrive at what I believe is victory, only to get stared down by the above messages in this post:

I ran a pytest --fixtures command and it seems to be complaining about a docstring not being available.

Any help is greatly appreciated.

I did another run through and this time it works…at a loss for where exactly the problem was but on this run-through I ran the requirements.txt install and then put pytest==3.6 (4.6 didn’t work) and then pytest-astropy==0.7.0. Thanks!

The most likely cause of the original failure is that you did not activate your virtual environment. Your prompt is the give away.