Skip to content

Conversation

@dkrako
Copy link
Member

@dkrako dkrako commented Mar 6, 2025

@SiQube
Copy link
Contributor

SiQube commented Mar 7, 2025

great idea, I also thought of that a while ago, thank you for tackling the issue.

initial feedback/thought: since these are not directly tests, maybe have another repository like testing where we put all fixtures etc.

@dkrako
Copy link
Member Author

dkrako commented Mar 12, 2025

I'm not sure that I understand. fixtures are a very common part of test suites. fixtures should be tested though.

The way I implemented this and imported in conftest.py is actually the intended way by pytest, so I'm rather confused about what you mean that fixtures are not directly tests.

What I really wouldn't like is creating another repository just for testing.

Can you provide a link to repository where your idea is implemented?

@SiQube
Copy link
Contributor

SiQube commented Apr 22, 2025

here with combination this

@dkrako
Copy link
Member Author

dkrako commented Apr 22, 2025

here with combination this

Ah thank you for the comment, now I understand what you mean. This isn't a separate repository, it's a dedicated module.

But as a side note: the fixtures.py you linked isn't that great, as it doesn't provide any fixtures. From the naming alone it's unclear what that module really achieves as the fixtures are actually defined in conftest.py.

I also thought about that originally as this is done in some packages, but currently I don't see much benefit to add this to the user API. If done bad, we would need to add pytest as a dependency (probably that's why the linked fixtures.py is so weird to avoid this). Additionally, this would lead to inflexibilities in development, as then we would need to take care of breaking changes.

I guess it makes sense in cases, where users extend the original package, so providing users with fixtures can make sense. For example in polars you can extend the api, so having fixtures available in a testing module is quite nice.

It will take some time until this will be finished, so we'll have some time to discuss this further.

Something like this could be better as it allows for more parametrizing:

import pytest

@pytest.fixture()
def argument_printer():
    def _foo(*args, **kwargs):
        return (args, kwargs)

    return _foo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants