-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using open() as context manager is the preferred way to close files to guarantee exception safety. This commit solves an occasional ResourceWarning, when CylP is used in unit tests run by pytest. There are more direct calls of open() without context manager in setup.py.
- Loading branch information
Showing
2 changed files
with
5 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import os | ||
from os.path import realpath, join | ||
currentDir = os.path.dirname(realpath(__file__)) | ||
__version__ = open(join(currentDir, 'VERSION')).read().strip() | ||
with open(join(currentDir, 'VERSION')) as f: | ||
__version__ = f.read().strip() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters