Skip to content

Commit cbc04c7

Browse files
committed
The test command is now taken as a dependency
1 parent 3daf868 commit cbc04c7

2 files changed

Lines changed: 3 additions & 37 deletions

File tree

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Installation and deployment
22
setuptools==38.2.5
33
twine==1.9.1
4+
bernardomg.tox-test-command==1.0.0
45

56
# Testing
67
tox==2.9.1

setup.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from codecs import open
99

1010
from setuptools import find_packages, setup
11-
from setuptools.command.test import test as test_command
11+
from bernardomg.tox_test_command import ToxTestCommand
1212

1313
"""
1414
PyPI configuration module.
@@ -43,41 +43,6 @@ def read(*names, **kwargs):
4343
version_lib = str(ast.literal_eval(version_lib.rstrip()))
4444

4545

46-
class _ToxTester(test_command):
47-
"""
48-
Tox test command.
49-
50-
Calls tox for running the tests.
51-
"""
52-
user_options = [
53-
('test-module=', 'm', "Run 'test_suite' in specified module"),
54-
('test-suite=', 's',
55-
"Run single test, case or suite (e.g. 'module.test_suite')"),
56-
('test-runner=', 'r', "Test runner to use"),
57-
('profile=', 'p', 'Test profile to use')
58-
]
59-
60-
def initialize_options(self):
61-
test_command.initialize_options(self)
62-
self.profile = None
63-
64-
def finalize_options(self):
65-
test_command.finalize_options(self)
66-
self.test_args = []
67-
68-
if self.profile is not None:
69-
# Adds the profile argument
70-
# For example: '-e=py36'
71-
self.test_args.append('-e=' + self.profile)
72-
73-
def run_tests(self):
74-
# import here, cause outside the eggs aren't loaded
75-
import tox
76-
77-
errcode = tox.cmdline(self.test_args)
78-
sys.exit(errcode)
79-
80-
8146
setup(
8247
name='dice-notation',
8348
packages=find_packages(),
@@ -111,6 +76,6 @@ def run_tests(self):
11176
tests_require=_tests_require,
11277
extras_require={'test': _tests_require},
11378
cmdclass={
114-
'test': _ToxTester
79+
'test': ToxTestCommand
11580
},
11681
)

0 commit comments

Comments
 (0)