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

Incompatibility with pytest-flakes? #105

Closed
niksite opened this issue Jan 4, 2022 · 2 comments · Fixed by #109
Closed

Incompatibility with pytest-flakes? #105

niksite opened this issue Jan 4, 2022 · 2 comments · Fixed by #109
Labels
bug Something isn't working more-info-needed Further information is requested
Milestone

Comments

@niksite
Copy link

niksite commented Jan 4, 2022

After updating pytest-socket to the 0.5.0 version, I cannot use pytest-socket (0.5.0) and pytest-flakes (4.0.5) together.
I see the following error:

item = <FlakesItem flake-8>

    def pytest_runtest_setup(item) -> None:
        """During each test item's setup phase,
        choose the behavior based on the configurations supplied.
    
        This is the bulk of the logic for the plugin.
        As the logic can be extensive, this method is allowed complexity.
        It may be refactored in the future to be more readable.
        """
    
        # If test has the `enable_socket` marker, we accept this as most explicit.
>       if "socket_enabled" in item.fixturenames or item.get_closest_marker(
            "enable_socket"
        ):
E       AttributeError: 'FlakesItem' object has no attribute 'fixturenames'

The 0.4.1 version working well.

@miketheman miketheman added the bug Something isn't working label Jan 5, 2022
@miketheman
Copy link
Owner

Thanks for the report, @niksite ! It makes sense that the change in 0.5.0 would be relevant - the change from an autouse fixture to using pytest hooks is where this is happening.

I haven't tried using this plugin along with pytest-flakes - it's not one of the tools in my toolbox right now.

According to the docs, the signature expected to be passed into this function should be an Item, and that's what I'm inspecting.
From this thread on pytest, it looks like the conversation resolves in that the custom object FlakesItem ought to implement the behavior.

Another approach surfaced was running with the flag --fixtures-per-test - maybe that would work for you?

@miketheman
Copy link
Owner

Should be fixed in 0.5.1!

@miketheman miketheman added this to the 0.5.1 milestone Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working more-info-needed Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants