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
Add missing import / requirement #988
Conversation
These are needed for the imports / requirements.
@@ -1,6 +1,7 @@ | |||
from django.contrib.auth.models import Group, User | |||
from django.contrib.contenttypes.models import ContentType | |||
|
|||
import factory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several lines in this file use factory.X
but the factory
import itself was missing... eg:
object_id = factory.SelfAttribute('content_object.id') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see, yes good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t think that’s necessary.
https://docs.python.org/3/reference/simple_stmts.html#the-import-statement
import foo.bar.baz # foo, foo.bar, and foo.bar.baz imported, foo bound locally
And indeed:
$ python
Python 3.10.8 (main, Oct 13 2022, 21:13:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import factory.django
>>> factory.LazyAttribute
<class 'factory.declarations.LazyAttribute'>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh interesting, I either never realized that or long ago forgot that!
@@ -1 +1,2 @@ | |||
Django | |||
factory_boy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, the Flask examples need updating.
Closing as unnecessary per #988 (comment) |
These are needed for the imports / requirements.