Home > Back-end >  What is this pytest value error traceback telling me to fix?
What is this pytest value error traceback telling me to fix?

Time:09-17

I'm attempting to run pytest in VS Code on a Django webapp that I did not build. Pytest is already installed as a dependency, but when I run the command:

pytest

I receive a ValueError: 'unknown configuration type: pathlist' traceback. I receive the same result if I run directly in my VS Code terminal as I do if I open the shell of the docker container with the running application and run pytest there.

I'm not sure how to interpret the results, although I read through the following to no avail:

Here is the error traceback:

Traceback (most recent call last):
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1373, in getini
    return self._inicache[name]
KeyError: 'python_paths'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 187, in console_main
    code = main()
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 145, in main
    config = _prepareconfig(args, plugins)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 324, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 55, in _multicall
    gen.send(outcome)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/helpconfig.py", line 102, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1017, in pytest_cmdline_parse
    self.parse(args)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1305, in parse
    self._preparse(args, addopts=addopts)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1207, in _preparse
    self.hook.pytest_load_initial_conftests(
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
    return outcome.get_result()
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
    raise ex[1].with_traceback(ex[2])
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
    res = hook_impl.function(*args)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/pytest_pythonpath.py", line 20, in pytest_load_initial_conftests
    for path in reversed(early_config.getini("python_paths")):
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1375, in getini
    self._inicache[name] = val = self._getini(name)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1436, in _getini
    return self._getini_unknown_type(name, type, value)
  File "/Users/aleholland/Documents/GitHub/mos-sfs/venv/lib/python3.8/site-packages/_pytest/config/__init__.py", line 1382, in _getini_unknown_type
    raise ValueError(msg, value)  # pragma: no cover
ValueError: ('unknown configuration type: pathlist', '/mos-sfs-v2/src')

Here is my pip list:

Package                           Version
--------------------------------- -----------
asgiref                           3.5.0
attrs                             21.4.0
autopep8                          1.6.0
base36                            0.1.1
beautifulsoup4                    4.9.3
black                             22.3.0
certifi                           2021.10.8
chardet                           4.0.0
click                             8.1.2
colorama                          0.4.4
configparser                      5.2.0
coverage                          6.3.2
crayons                           0.4.0
Django                            3.2.3
django-admin-list-filter-dropdown 1.0.3
django-admin-rangefilter          0.8.1
django-appconf                    1.0.5
django-crispy-forms               1.11.2
django-easy-select2               1.5.7
django-filter                     2.4.0
django-json-widget                1.1.1
django-select2                    7.7.1
django-tables2                    2.3.0
djangorestframework               3.12.4
et-xmlfile                        1.1.0
flake8                            4.0.1
future                            0.18.2
gunicorn                          20.1.0
html5lib                          1.1
idna                              2.10
iniconfig                         1.1.1
jdcal                             1.4.1
lxml                              4.6.3
mccabe                            0.6.1
mypy-extensions                   0.4.3
numpy                             1.22.3
openpyxl                          3.0.5
packaging                         21.3
pandas                            1.1.5
pathspec                          0.9.0
Pillow                            9.1.0
Pint                              0.17
pip                               22.2.2
platformdirs                      2.5.2
pluggy                            1.0.0
psycopg2-binary                   2.8.6
py                                1.11.0
pycodestyle                       2.8.0
pyflakes                          2.4.0
pyparsing                         3.0.8
pytest                            7.1.3
pytest-cov                        2.12.0
pytest-django                     4.3.0
pytest-pythonpath                 0.7.3
python-dateutil                   2.8.2
python-dotenv                     0.17.1
pytz                              2022.1
requests                          2.25.1
selenium                          3.141.0
setuptools                        62.1.0
six                               1.16.0
soupsieve                         2.3.2.post1
sqlparse                          0.4.2
toml                              0.10.2
tomli                             2.0.1
treepoem                          3.8.0
typing_extensions                 4.2.0
urllib3                           1.26.9
webdriver-manager                 3.3.0
webencodings                      0.5.1
wheel                             0.37.1
xlrd                              2.0.1

Pytest.ini contents:

[pytest]
DJANGO_SETTINGS_MODULE = src.project.settings
addopts =  -v -p no:warnings --nomigrations --cov-report html --cov=. --no-cov-on-fail --cov-config=.coveragerc
python_files = tests.py test_*.py *_tests.py
python_paths = /mos-sfs-v2/src

CodePudding user response:

When running pytest 7.0 , you may need to update your pytest.ini in regard to swapping python_paths by pythonpaths.

  • Related