|
1 | 1 | from codecs import open |
2 | 2 | from os.path import abspath, dirname, join |
| 3 | +from subprocess import call |
3 | 4 |
|
4 | | -from setuptools import find_packages, setup |
| 5 | +from setuptools import find_packages, setup, Command |
5 | 6 |
|
6 | 7 | from autoarray import __version__ |
7 | 8 |
|
| 9 | + |
| 10 | +class RunTests(Command): |
| 11 | + """Run all tests.""" |
| 12 | + |
| 13 | + description = "run tests" |
| 14 | + user_options = [] |
| 15 | + |
| 16 | + def initialize_options(self): |
| 17 | + pass |
| 18 | + |
| 19 | + def finalize_options(self): |
| 20 | + pass |
| 21 | + |
| 22 | + def run(self): |
| 23 | + """Run all tests!""" |
| 24 | + errno = call(["py.test", "--cov=autolens", "--cov-report=term-missing"]) |
| 25 | + raise SystemExit(errno) |
| 26 | + |
| 27 | + |
8 | 28 | this_dir = abspath(dirname(__file__)) |
9 | 29 | with open(join(this_dir, "README.md"), encoding="utf-8") as file: |
10 | 30 | long_description = file.read() |
|
40 | 60 | keywords="cli", |
41 | 61 | packages=find_packages(exclude=["docs"]), |
42 | 62 | install_requires=requirements, |
43 | | - setup_requires=["pytest-runner"], |
44 | | - tests_require=["pytest"], |
| 63 | + extras_require={"test": ["coverage", "pytest", "pytest-cov"]}, |
| 64 | + cmd_class={"test": RunTests} |
45 | 65 | ) |
0 commit comments