gregmuellegger / django-autofixture

Can create auto-generated test data.
BSD 3-Clause "New" or "Revised" License
460 stars 118 forks source link

Explicitly close files to avoid ResourceWarnings #87

Closed nicktimko closed 8 years ago

nicktimko commented 8 years ago

Maybe a bit excessive, but it's easy enough to suppress scores of ResourceWarnings.

/Users/ntimkovich/Code/django-autofixture/autofixture/__init__.py:203: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Users/ntimkovich/Code/django-autofixture/autofixture_tests/appconfig_test/autofixtures.py' mode='r' encoding='utf-8'>
  imp.find_module('autofixtures', app_path)

/Users/ntimkovich/Code/django-autofixture/autofixture/__init__.py:217: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Users/ntimkovich/.pyenv/versions/djaf/lib/python3.5/site-packages/django/contrib/admin/tests.py' mode='r' encoding='utf-8'>
  imp.find_module('tests', app_path)

× a few hundred

:sparkles: Super clean! :sparkles:

gregmuellegger commented 8 years ago

Very good! Thanks for the contribution.

gregmuellegger commented 8 years ago

Cheers, your patch is in the new release: https://pypi.python.org/pypi/django-autofixture/0.12.1