hammett icon indicating copy to clipboard operation
hammett copied to clipboard

Support for fixtures in conftest.py

Open jakob-herpel-by opened this issue 3 years ago • 5 comments

Hi, thank you for the cool project.

Would it be possible to add support for fixtures specified in conftest.py that are imported magically by pytest?

Greetings

Jakob

jakob-herpel-by avatar Mar 22 '21 16:03 jakob-herpel-by

So these would be fixtures that would be set up once per session and then never explicitly used? Kind of like on a module level using mark.use_fixtures?

boxed avatar Mar 23 '21 08:03 boxed

Or fixtures that needs to be reused across different tests (modules) and are explicitly used...

hmvp avatar Jul 23 '21 08:07 hmvp

I found a workaround by running hammett as follows: hammett tests/conftest.py tests/ This allows the fixtures in tests/conftest.py to be noticed and are run as expected.

kronenpj avatar Aug 11 '21 21:08 kronenpj

@boxed @kronenpj The workaround did not work for me - I still got

test_something() missing 3 required positional arguments: 'monkeypatch', 'mock_filesystem', and 'repository'

JamieMcKernanKaizen avatar Dec 22 '21 11:12 JamieMcKernanKaizen

I'll happily accept a PR. The support for conftest.py is in load_plugins() which is a tiny little function. As you can see it doesn't do much right now.

boxed avatar Dec 22 '21 12:12 boxed