Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Internal error - config has not been correctly loaded. Over 3.2.1 #196

Closed
lyz-code opened this issue Apr 6, 2021 · 3 comments

Comments

@lyz-code
Copy link

lyz-code commented Apr 6, 2021

Since pytest-cases 3.2.1 I'm getting the following error:

----------------
- Testing code -
----------------
pytest --cov-report term-missing --cov src tests 
ImportError while loading conftest '/tmp/tmp.PxdGvyGRrZ/repository-orm/tests/conftest.py'.
tests/conftest.py:78: in <module>
    ) -> Tuple[Any, Repository, Repository, RepositoryTester]:
../env/lib/python3.7/site-packages/pytest_cases/common_pytest.py:843: in apply
    return apply_decorator(test_or_fixture_func, container)
../env/lib/python3.7/site-packages/pytest_cases/case_parametrizer_new.py:142: in _apply_parametrization
    argvalues = get_parametrize_args(host_class_or_module, cases_funs, prefix=prefix, debug=debug, scope=scope)
../env/lib/python3.7/site-packages/pytest_cases/case_parametrizer_new.py:308: in get_parametrize_args
    return [c for _f in cases_funs for c in case_to_argvalues(host_class_or_module, _f, prefix, scope, debug)]
../env/lib/python3.7/site-packages/pytest_cases/case_parametrizer_new.py:308: in <listcomp>
    return [c for _f in cases_funs for c in case_to_argvalues(host_class_or_module, _f, prefix, scope, debug)]
../env/lib/python3.7/site-packages/pytest_cases/case_parametrizer_new.py:335: in case_to_argvalues
    meta = MiniMetafunc(case_fun)
../env/lib/python3.7/site-packages/pytest_cases/common_pytest.py:595: in __init__
    raise ValueError("Internal error - config has not been correctly loaded. Please report")
E   ValueError: Internal error - config has not been correctly loaded. Please report
make: *** [Makefile:66: test-code] Error 4

Steps to reproduce

git clone https://github.com/lyz-code/repository-orm
cd repository-orm
make install
make test # pytest-cases 3.1.1 -> Works
pip install pytest-cases==3.3.0
make test # Error is shown

I've tried debugging it without success. Can you please help me?

Thanks!

@smarie
Copy link
Owner

smarie commented Apr 7, 2021

Thanks @lyz-code ! This seems to be caused by usage of cases in the conftest.py.

I found out that conftest.py files are loaded before the pytest_configure hook. I'll fix this now by simplyreading the early config in pytest_load_initial_conftests hook instead.

@smarie smarie closed this as completed in 710bbcb Apr 7, 2021
@smarie
Copy link
Owner

smarie commented Apr 7, 2021

Fixed in 3.4.4. Let me know if this works for you ! Thanks again for letting me know

@lyz-code
Copy link
Author

lyz-code commented Apr 7, 2021

Yes it did! thanks for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants