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

[Bug]: Tests fail to run: TypeError: Test file has to be YAML list, got <class 'dict'> #731

Open
2 of 4 tasks
yurivict opened this issue Dec 11, 2024 · 1 comment · May be fixed by #742
Open
2 of 4 tasks

[Bug]: Tests fail to run: TypeError: Test file has to be YAML list, got <class 'dict'> #731

yurivict opened this issue Dec 11, 2024 · 1 comment · May be fixed by #742
Labels

Comments

@yurivict
Copy link

Email (Optional)

No response

Version

2024.12.10

Which OS(es) are you using?

  • MacOS
  • Windows
  • Linux

What happened?

========================================================================================== ERRORS ===========================================================================================
___________________________________________________________________ ERROR collecting tests/test_files/test_settings.yaml ____________________________________________________________________
/usr/local/lib/python3.11/site-packages/pytest_mypy_plugins/collect.py:117: in collect
    validate_schema(parsed_file, is_closed=self.config.option.mypy_closed_schema)
/usr/local/lib/python3.11/site-packages/pytest_mypy_plugins/collect.py:45: in validate_schema
    raise TypeError(f"Test file has to be YAML list, got {type(data)!r}.")
E   TypeError: Test file has to be YAML list, got <class 'dict'>.
===================================================================================== warnings summary ======================================================================================
tests/test_design_patterns.py:55
  /usr/ports/devel/py-monty/work-py311/monty-2024.12.10/tests/test_design_patterns.py:55: PytestCollectionWarning: cannot collect test class 'TestClass' because it has a __init__ constructor (from: tests/test_design_patterns.py)
    @cached_class

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================ 1 warning, 1 error in 2.25s ================================================================================

Python-3.11

Code snippet

No response

Log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@yurivict yurivict added the bug label Dec 11, 2024
@DanielYang59
Copy link
Contributor

DanielYang59 commented Jan 18, 2025

Hi @yurivict

Looks like you have pytest-mypy-plugins installed and as a result tests/test_files/test_settings.yaml is picked up as a test script (I never use pytest-mypy-plugins so cannot comment if this is a intended, but by the naming of the YAML file, it might be as it starts with test_xxx just like any other test script).

Also as pytest-mypy-plugins is either a default pytest plugin nor required by monty, I don't think this is a monty issue. But I'm happy to rename it to avoid such issue :)


The following warning should be fixed in #702:

  /usr/ports/devel/py-monty/work-py311/monty-2024.12.10/tests/test_design_patterns.py:55: PytestCollectionWarning: cannot collect test class 'TestClass' because it has a __init__ constructor (from: tests/test_design_patterns.py)

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