|
9 | 9 |
|
10 | 10 | from setuptools import find_packages, setup |
11 | 11 | from setuptools.command.test import test as test_command |
| 12 | +from distutils.command.clean import clean as clean_command |
12 | 13 | from distutils.cmd import Command |
13 | 14 |
|
14 | 15 | """ |
@@ -50,7 +51,13 @@ class _ToxTester(test_command): |
50 | 51 |
|
51 | 52 | Calls tox for running the tests. |
52 | 53 | """ |
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 | + ] |
54 | 61 |
|
55 | 62 | def initialize_options(self): |
56 | 63 | test_command.initialize_options(self) |
@@ -80,24 +87,28 @@ class _RequirementsCommand(Command): |
80 | 87 | Installs all the requirements defined in the requirements file with pip. |
81 | 88 | """ |
82 | 89 | description = 'install the requirements defined in requirements.txt' |
83 | | - user_options = [] |
| 90 | + user_options = [('requirements-file=', 'f', 'requirements file to use')] |
84 | 91 |
|
85 | 92 | def initialize_options(self): |
86 | | - pass |
| 93 | + self.requirements_file = None |
87 | 94 |
|
88 | 95 | def finalize_options(self): |
89 | | - pass |
| 96 | + if self.requirements_file is None: |
| 97 | + self.requirements_file = 'requirements.txt' |
90 | 98 |
|
91 | 99 | def run(self): |
92 | 100 | # import here, cause outside the eggs aren't loaded |
93 | 101 | import pip |
94 | 102 |
|
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() |
97 | 105 |
|
| 106 | + # Removes empty lines |
98 | 107 | requirements = filter(lambda k: bool(k.strip()), requirements) |
| 108 | + # Removes comments |
99 | 109 | requirements = filter(lambda k: not k.strip().startswith('#'), requirements) |
100 | 110 |
|
| 111 | + # Installs the requirements |
101 | 112 | for requirement in requirements: |
102 | 113 | pip.main(['install', requirement]) |
103 | 114 |
|
|
0 commit comments