diff options
author | Mike Crute <mike@crute.us> | 2019-04-13 01:30:36 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2019-04-13 01:30:36 +0000 |
commit | d9e353e7f19da741dcf372246b4d5640cb788488 (patch) | |
tree | 212160bab9b6f34b34b28dbcd123ce5370b49f93 | |
parent | f394e36d82a85aff881812163ade0ec87888c86b (diff) | |
download | pydora-d9e353e7f19da741dcf372246b4d5640cb788488.tar.bz2 pydora-d9e353e7f19da741dcf372246b4d5640cb788488.tar.xz pydora-d9e353e7f19da741dcf372246b4d5640cb788488.zip |
setup.py uses Python 3
-rwxr-xr-x | setup.py | 26 |
1 files changed, 4 insertions, 22 deletions
@@ -1,36 +1,20 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | 2 | ||
3 | import itertools | ||
4 | from setuptools.command.test import test | 3 | from setuptools.command.test import test |
5 | from setuptools import setup, find_packages | 4 | from setuptools import setup, find_packages |
6 | 5 | ||
7 | 6 | ||
8 | # Python 2 setuptools test class is not an object | ||
9 | class TestsWithCoverage(test): | 7 | class TestsWithCoverage(test): |
10 | 8 | ||
11 | description = "run unit tests with coverage" | 9 | description = "run unit tests with coverage" |
12 | 10 | ||
13 | # Copypasta from setuptools 36.0.1 because older versions don't have it | ||
14 | @staticmethod | ||
15 | def install_dists(dist): | ||
16 | ir_d = dist.fetch_build_eggs(dist.install_requires or []) | ||
17 | tr_d = dist.fetch_build_eggs(dist.tests_require or []) | ||
18 | return itertools.chain(ir_d, tr_d) | ||
19 | |||
20 | def run(self): | 11 | def run(self): |
21 | # Must install test_requires before importing coverage | 12 | from coverage import Coverage |
22 | self.install_dists(self.distribution) | ||
23 | |||
24 | from coverage import coverage | ||
25 | 13 | ||
26 | cov = coverage(source=self.distribution.packages) | 14 | cov = Coverage(source=self.distribution.packages) |
27 | cov.start() | 15 | cov.start() |
28 | 16 | ||
29 | # Unittest calls exit prior to python 3. How naughty | 17 | super().run() |
30 | try: | ||
31 | super().run() | ||
32 | except SystemExit: | ||
33 | pass | ||
34 | 18 | ||
35 | cov.stop() | 19 | cov.stop() |
36 | cov.xml_report() | 20 | cov.xml_report() |
@@ -59,9 +43,7 @@ setup( | |||
59 | setup_requires=[ | 43 | setup_requires=[ |
60 | "wheel", | 44 | "wheel", |
61 | "flake8>=3.3", | 45 | "flake8>=3.3", |
62 | ], | 46 | "setuptools>=36.0.1", |
63 | tests_require=[ | ||
64 | "mock>=2,<3", | ||
65 | "coverage>=4.1,<5", | 47 | "coverage>=4.1,<5", |
66 | ], | 48 | ], |
67 | install_requires=[ | 49 | install_requires=[ |