From 232e1f9dabc390b4777fdd986a420382566099ca Mon Sep 17 00:00:00 2001 From: Thijs Triemstra Date: Sun, 26 Feb 2017 23:00:36 +0100 Subject: [PATCH] make sure to close files --- setup.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index d1191271..1fbbf1d1 100644 --- a/setup.py +++ b/setup.py @@ -5,10 +5,16 @@ import sys from setuptools import setup -README = open(os.path.join(os.path.dirname(__file__), "README.rst")).read() -CONTRIB = open(os.path.join(os.path.dirname(__file__), "CONTRIBUTING.rst")).read() -CHANGES = open(os.path.join(os.path.dirname(__file__), "CHANGES.rst")).read() -version = open(os.path.join(os.path.dirname(__file__), "VERSION.txt")).read().strip() + +def read_file(fname): + with open(os.path.join(os.path.dirname(__file__), fname)) as r: + return r.read() + + +README = read_file("README.rst") +CONTRIB = read_file("CONTRIBUTING.rst") +CHANGES = read_file("CHANGES.rst") +version = read_file("VERSION.txt").strip() needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) pytest_runner = ['pytest-runner'] if needs_pytest else [] @@ -32,7 +38,7 @@ packages=["luma.oled"], zip_safe=False, install_requires=["luma.core>=0.2.0"], - setup_requires=[] + pytest_runner, + setup_requires=pytest_runner, tests_require=["mock", "pytest", "pytest-cov", "python-coveralls"], classifiers=[ "License :: OSI Approved :: MIT License",