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

auto_container not working? #179

Closed
shakefu opened this issue Dec 15, 2023 · 3 comments
Closed

auto_container not working? #179

shakefu opened this issue Dec 15, 2023 · 3 comments

Comments

@shakefu
Copy link

shakefu commented Dec 15, 2023

Seems like something internally is broken with the auto_container fixture?
image

Referencing the test code in the repo here, we have this configuration:
image

Is it just misconfigured or is this a bug?

@dcermak
Copy link
Owner

dcermak commented Dec 16, 2023

I am not aware of any internal breakage, we are using pytest_container in production all the time and I saw no issues popping up recently in our setup.

I have two ideas:

  1. Did you add the pytest_generate_tests function to conftest.py as indicated in the tutorial: https://dcermak.github.io/pytest_container/tutorials.html#getting-started-with-pytest-container? (Sorry, it's probably not very visible there and should be far more prominent)
  2. You might want to add a @pytest.mark.asyncio decorator to your test function. Otherwise pytest will not execute your tests. But I doubt that's the actual issue.

Is your code public? If yes, can you share a link and I'd take a look.

@shakefu
Copy link
Author

shakefu commented Dec 17, 2023

  1. I missed that, will retry, thanks.
  2. I'm using the asyncio_mode = "auto" which was added uh... semi-recently.
image

Edit: Code isn't public, sadly.

@shakefu
Copy link
Author

shakefu commented Dec 17, 2023

Looks like that resolved it. I think I just misunderstood when I saw that section of the docs, thinking it was an optional thing for generative tests, not required for the auto_container...

@shakefu shakefu closed this as completed Dec 17, 2023
dcermak added a commit that referenced this issue Dec 18, 2023
If the user does not add the `auto_container_parametrize` call to
`pytest_generate_tests()` in `conftest.py`, then they get a weird error
message. This commit improves the error message, indicating where the issue
might be.
This should make it easier to spot issues like
#179 easier.
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