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

Reusing ignore kwarg #30

Open
PaulWasTaken opened this issue May 5, 2021 · 0 comments
Open

Reusing ignore kwarg #30

PaulWasTaken opened this issue May 5, 2021 · 0 comments

Comments

@PaulWasTaken
Copy link

PaulWasTaken commented May 5, 2021

Greetings,
I am using pytest-freezegun with parametrize and come across an interesting problem.
Imagine, your code is

@pytest.mark.parametrize('param', (1, 2))
@pytest.mark.freeze_time('2021-01-01', ignore=['asyncio'])
async def test_smth(param):
    pass

Since there is https://github.com/ktosiek/pytest-freezegun/blob/master/pytest_freezegun.py#L35, we won't get asyncio ignored on the second call.

What do you think about deepcopy kwargs?
So, the code would look like

from copy import deepcopy

...
@pytest.fixture(name=FIXTURE_NAME)
def freezer_fixture(request):
    ...
    if marker:
        kwargs_copy = deepcopy(marker.kwargs)

        ignore = kwargs_copy.pop('ignore', [])
        args = marker.args
        kwargs = kwargs_copy
wimglenn added a commit to pytest-dev/pytest-freezer that referenced this issue Oct 18, 2022
…d _pytest.runner, so it is not necessary to add these (see https://github.com/spulec/freezegun\#ignore-packages). user should probably also make use of extend_ignore_list to just add to default ignores. as a bonus, avoiding to mutate ignore kwarg should avoid ktosiek/pytest-freezegun#30
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

1 participant