CleanCut / green

Green is a clean, colorful, fast python test runner.
MIT License
785 stars 75 forks source link

ResourceWarning: unclosed file VERSION #200

Closed grigi closed 5 years ago

grigi commented 5 years ago

When running with PYTHONWARNINGS=default envvar, I get the following:

.pyenv/lib64/python3.6/site-packages/green/version.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper name='.pyenv/lib64/python3.6/site-packages/green/VERSION' mode='r' encoding='UTF-8'>

It seems that green isn't closing its own VERSION file.

Changing line 7 to:

with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as vfile:  # pragma nocover
    __version__ = vfile.read().strip()

should resolve it.

CleanCut commented 5 years ago

Good catch, thanks!

CleanCut commented 5 years ago

Fix is in 2.13.1 (just released).