Register factory fixture name
See original GitHub issueCould you provide a way to register a factory fixture with a different name?
Maybe something like register(ExampleFactory, factory_name="my_example_factory")
I tried the following but it still uses example_factory
as the fixture name:
from myapp.factories import ExampleFactory as MyExampleFactory
register(MyExampleFactory)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Welcome to pytest-factoryboy's documentation! — pytest ...
Library exports a function to register factories as fixtures. ... The fixture name convention is to use the lowercase-underscore form of the class...
Read more >SubFactory uses wrong fixture name when factory class ...
This gist demonstrates a failing test where the generated SubFactory fixture is expecting to find a b_model__name fixture when the one available ...
Read more >python - Why would a pytest factory as fixture be used over ...
A factory fixture allows much more composability: e.g. you can make use of any other fixtures here (local injection, the test is agnostic...
Read more >pytest fixtures: explicit, modular, scalable
fixtures have explicit names and are activated by declaring their use from test functions, modules, classes or whole projects. fixtures are implemented in...
Read more >pytest-factoryboy
Factory fixtures allow using factories without importing them. The fixture name convention is to use the lowercase-underscore form of the class name. import ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
register()
function creates 2 fixtures:factory_class.__name__
_name
parameterMaybe I am wrong, but I thought this issue is about using a custom name for the factory class (point 1.) fixture.
I’ll consider this solved then.