From d9e353e7f19da741dcf372246b4d5640cb788488 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sat, 13 Apr 2019 01:30:36 +0000 Subject: setup.py uses Python 3 --- setup.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/setup.py b/setup.py index 63abed1..9c75eb1 100755 --- a/setup.py +++ b/setup.py @@ -1,36 +1,20 @@ #!/usr/bin/env python -import itertools from setuptools.command.test import test from setuptools import setup, find_packages -# Python 2 setuptools test class is not an object class TestsWithCoverage(test): description = "run unit tests with coverage" - # Copypasta from setuptools 36.0.1 because older versions don't have it - @staticmethod - def install_dists(dist): - ir_d = dist.fetch_build_eggs(dist.install_requires or []) - tr_d = dist.fetch_build_eggs(dist.tests_require or []) - return itertools.chain(ir_d, tr_d) - def run(self): - # Must install test_requires before importing coverage - self.install_dists(self.distribution) - - from coverage import coverage + from coverage import Coverage - cov = coverage(source=self.distribution.packages) + cov = Coverage(source=self.distribution.packages) cov.start() - # Unittest calls exit prior to python 3. How naughty - try: - super().run() - except SystemExit: - pass + super().run() cov.stop() cov.xml_report() @@ -59,9 +43,7 @@ setup( setup_requires=[ "wheel", "flake8>=3.3", - ], - tests_require=[ - "mock>=2,<3", + "setuptools>=36.0.1", "coverage>=4.1,<5", ], install_requires=[ -- cgit v1.2.3