Skip to content

Commit febe79c

Browse files
committed
Added arguments to the commands
1 parent a3a3e4e commit febe79c

1 file changed

Lines changed: 17 additions & 6 deletions

File tree

setup.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from setuptools import find_packages, setup
1111
from setuptools.command.test import test as test_command
12+
from distutils.command.clean import clean as clean_command
1213
from distutils.cmd import Command
1314

1415
"""
@@ -50,7 +51,13 @@ class _ToxTester(test_command):
5051
5152
Calls tox for running the tests.
5253
"""
53-
user_options = [('profile=', 'p', 'Test profile')]
54+
user_options = [
55+
('test-module=', 'm', "Run 'test_suite' in specified module"),
56+
('test-suite=', 's',
57+
"Run single test, case or suite (e.g. 'module.test_suite')"),
58+
('test-runner=', 'r', "Test runner to use"),
59+
('profile=', 'p', 'Test profile to use')
60+
]
5461

5562
def initialize_options(self):
5663
test_command.initialize_options(self)
@@ -80,24 +87,28 @@ class _RequirementsCommand(Command):
8087
Installs all the requirements defined in the requirements file with pip.
8188
"""
8289
description = 'install the requirements defined in requirements.txt'
83-
user_options = []
90+
user_options = [('requirements-file=', 'f', 'requirements file to use')]
8491

8592
def initialize_options(self):
86-
pass
93+
self.requirements_file = None
8794

8895
def finalize_options(self):
89-
pass
96+
if self.requirements_file is None:
97+
self.requirements_file = 'requirements.txt'
9098

9199
def run(self):
92100
# import here, cause outside the eggs aren't loaded
93101
import pip
94102

95-
with open('requirements.txt') as f:
96-
requirements = f.read().splitlines()
103+
with open(self.requirements_file) as file:
104+
requirements = file.read().splitlines()
97105

106+
# Removes empty lines
98107
requirements = filter(lambda k: bool(k.strip()), requirements)
108+
# Removes comments
99109
requirements = filter(lambda k: not k.strip().startswith('#'), requirements)
100110

111+
# Installs the requirements
101112
for requirement in requirements:
102113
pip.main(['install', requirement])
103114

0 commit comments

Comments
 (0)