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

calling reset() on a fresh Iterator causes exception #443

Closed
rrauenza opened this Issue Jan 25, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@rrauenza
Contributor

rrauenza commented Jan 25, 2018

  File ".../virtualenv-2.7.5/lib/python2.7/site-packages/factory/declarations.py", line 186, in reset
    self.iterator.reset()
AttributeError: 'NoneType' object has no attribute 'reset'

This is of course because we haven't used the iterator yet! But in my use case, I have a factory that I want to reset the iterator at the top of a loop ... (Ok, I could move it to the bottom instead)

What do you think of just adding if self.iterator above the call?

@rbarrois

This comment has been minimized.

Member

rbarrois commented Jan 28, 2018

That's a great idea — or a good bugfix, depending on your point of view ;)

I'll merge it right away.

@rbarrois rbarrois added the Bug label Jan 28, 2018

@rbarrois rbarrois closed this in 153d087 Jan 28, 2018

@rrauenza

This comment has been minimized.

Contributor

rrauenza commented Jan 30, 2018

Thanks! And thanks for the package -- it makes TDD so much easier!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment