1 | n/a | """Tests for distutils.dist.""" |
---|
2 | n/a | import os |
---|
3 | n/a | import io |
---|
4 | n/a | import sys |
---|
5 | n/a | import unittest |
---|
6 | n/a | import warnings |
---|
7 | n/a | import textwrap |
---|
8 | n/a | |
---|
9 | n/a | from unittest import mock |
---|
10 | n/a | |
---|
11 | n/a | from distutils.dist import Distribution, fix_help_options, DistributionMetadata |
---|
12 | n/a | from distutils.cmd import Command |
---|
13 | n/a | |
---|
14 | n/a | from test.support import TESTFN, captured_stdout, run_unittest |
---|
15 | n/a | from distutils.tests import support |
---|
16 | n/a | from distutils import log |
---|
17 | n/a | |
---|
18 | n/a | |
---|
19 | n/a | class test_dist(Command): |
---|
20 | n/a | """Sample distutils extension command.""" |
---|
21 | n/a | |
---|
22 | n/a | user_options = [ |
---|
23 | n/a | ("sample-option=", "S", "help text"), |
---|
24 | n/a | ] |
---|
25 | n/a | |
---|
26 | n/a | def initialize_options(self): |
---|
27 | n/a | self.sample_option = None |
---|
28 | n/a | |
---|
29 | n/a | |
---|
30 | n/a | class TestDistribution(Distribution): |
---|
31 | n/a | """Distribution subclasses that avoids the default search for |
---|
32 | n/a | configuration files. |
---|
33 | n/a | |
---|
34 | n/a | The ._config_files attribute must be set before |
---|
35 | n/a | .parse_config_files() is called. |
---|
36 | n/a | """ |
---|
37 | n/a | |
---|
38 | n/a | def find_config_files(self): |
---|
39 | n/a | return self._config_files |
---|
40 | n/a | |
---|
41 | n/a | |
---|
42 | n/a | class DistributionTestCase(support.LoggingSilencer, |
---|
43 | n/a | support.TempdirManager, |
---|
44 | n/a | support.EnvironGuard, |
---|
45 | n/a | unittest.TestCase): |
---|
46 | n/a | |
---|
47 | n/a | def setUp(self): |
---|
48 | n/a | super(DistributionTestCase, self).setUp() |
---|
49 | n/a | self.argv = sys.argv, sys.argv[:] |
---|
50 | n/a | del sys.argv[1:] |
---|
51 | n/a | |
---|
52 | n/a | def tearDown(self): |
---|
53 | n/a | sys.argv = self.argv[0] |
---|
54 | n/a | sys.argv[:] = self.argv[1] |
---|
55 | n/a | super(DistributionTestCase, self).tearDown() |
---|
56 | n/a | |
---|
57 | n/a | def create_distribution(self, configfiles=()): |
---|
58 | n/a | d = TestDistribution() |
---|
59 | n/a | d._config_files = configfiles |
---|
60 | n/a | d.parse_config_files() |
---|
61 | n/a | d.parse_command_line() |
---|
62 | n/a | return d |
---|
63 | n/a | |
---|
64 | n/a | def test_command_packages_unspecified(self): |
---|
65 | n/a | sys.argv.append("build") |
---|
66 | n/a | d = self.create_distribution() |
---|
67 | n/a | self.assertEqual(d.get_command_packages(), ["distutils.command"]) |
---|
68 | n/a | |
---|
69 | n/a | def test_command_packages_cmdline(self): |
---|
70 | n/a | from distutils.tests.test_dist import test_dist |
---|
71 | n/a | sys.argv.extend(["--command-packages", |
---|
72 | n/a | "foo.bar,distutils.tests", |
---|
73 | n/a | "test_dist", |
---|
74 | n/a | "-Ssometext", |
---|
75 | n/a | ]) |
---|
76 | n/a | d = self.create_distribution() |
---|
77 | n/a | # let's actually try to load our test command: |
---|
78 | n/a | self.assertEqual(d.get_command_packages(), |
---|
79 | n/a | ["distutils.command", "foo.bar", "distutils.tests"]) |
---|
80 | n/a | cmd = d.get_command_obj("test_dist") |
---|
81 | n/a | self.assertIsInstance(cmd, test_dist) |
---|
82 | n/a | self.assertEqual(cmd.sample_option, "sometext") |
---|
83 | n/a | |
---|
84 | n/a | def test_venv_install_options(self): |
---|
85 | n/a | sys.argv.append("install") |
---|
86 | n/a | self.addCleanup(os.unlink, TESTFN) |
---|
87 | n/a | |
---|
88 | n/a | fakepath = '/somedir' |
---|
89 | n/a | |
---|
90 | n/a | with open(TESTFN, "w") as f: |
---|
91 | n/a | print(("[install]\n" |
---|
92 | n/a | "install-base = {0}\n" |
---|
93 | n/a | "install-platbase = {0}\n" |
---|
94 | n/a | "install-lib = {0}\n" |
---|
95 | n/a | "install-platlib = {0}\n" |
---|
96 | n/a | "install-purelib = {0}\n" |
---|
97 | n/a | "install-headers = {0}\n" |
---|
98 | n/a | "install-scripts = {0}\n" |
---|
99 | n/a | "install-data = {0}\n" |
---|
100 | n/a | "prefix = {0}\n" |
---|
101 | n/a | "exec-prefix = {0}\n" |
---|
102 | n/a | "home = {0}\n" |
---|
103 | n/a | "user = {0}\n" |
---|
104 | n/a | "root = {0}").format(fakepath), file=f) |
---|
105 | n/a | |
---|
106 | n/a | # Base case: Not in a Virtual Environment |
---|
107 | n/a | with mock.patch.multiple(sys, prefix='/a', base_prefix='/a') as values: |
---|
108 | n/a | d = self.create_distribution([TESTFN]) |
---|
109 | n/a | |
---|
110 | n/a | option_tuple = (TESTFN, fakepath) |
---|
111 | n/a | |
---|
112 | n/a | result_dict = { |
---|
113 | n/a | 'install_base': option_tuple, |
---|
114 | n/a | 'install_platbase': option_tuple, |
---|
115 | n/a | 'install_lib': option_tuple, |
---|
116 | n/a | 'install_platlib': option_tuple, |
---|
117 | n/a | 'install_purelib': option_tuple, |
---|
118 | n/a | 'install_headers': option_tuple, |
---|
119 | n/a | 'install_scripts': option_tuple, |
---|
120 | n/a | 'install_data': option_tuple, |
---|
121 | n/a | 'prefix': option_tuple, |
---|
122 | n/a | 'exec_prefix': option_tuple, |
---|
123 | n/a | 'home': option_tuple, |
---|
124 | n/a | 'user': option_tuple, |
---|
125 | n/a | 'root': option_tuple, |
---|
126 | n/a | } |
---|
127 | n/a | |
---|
128 | n/a | self.assertEqual( |
---|
129 | n/a | sorted(d.command_options.get('install').keys()), |
---|
130 | n/a | sorted(result_dict.keys())) |
---|
131 | n/a | |
---|
132 | n/a | for (key, value) in d.command_options.get('install').items(): |
---|
133 | n/a | self.assertEqual(value, result_dict[key]) |
---|
134 | n/a | |
---|
135 | n/a | # Test case: In a Virtual Environment |
---|
136 | n/a | with mock.patch.multiple(sys, prefix='/a', base_prefix='/b') as values: |
---|
137 | n/a | d = self.create_distribution([TESTFN]) |
---|
138 | n/a | |
---|
139 | n/a | for key in result_dict.keys(): |
---|
140 | n/a | self.assertNotIn(key, d.command_options.get('install', {})) |
---|
141 | n/a | |
---|
142 | n/a | def test_command_packages_configfile(self): |
---|
143 | n/a | sys.argv.append("build") |
---|
144 | n/a | self.addCleanup(os.unlink, TESTFN) |
---|
145 | n/a | f = open(TESTFN, "w") |
---|
146 | n/a | try: |
---|
147 | n/a | print("[global]", file=f) |
---|
148 | n/a | print("command_packages = foo.bar, splat", file=f) |
---|
149 | n/a | finally: |
---|
150 | n/a | f.close() |
---|
151 | n/a | |
---|
152 | n/a | d = self.create_distribution([TESTFN]) |
---|
153 | n/a | self.assertEqual(d.get_command_packages(), |
---|
154 | n/a | ["distutils.command", "foo.bar", "splat"]) |
---|
155 | n/a | |
---|
156 | n/a | # ensure command line overrides config: |
---|
157 | n/a | sys.argv[1:] = ["--command-packages", "spork", "build"] |
---|
158 | n/a | d = self.create_distribution([TESTFN]) |
---|
159 | n/a | self.assertEqual(d.get_command_packages(), |
---|
160 | n/a | ["distutils.command", "spork"]) |
---|
161 | n/a | |
---|
162 | n/a | # Setting --command-packages to '' should cause the default to |
---|
163 | n/a | # be used even if a config file specified something else: |
---|
164 | n/a | sys.argv[1:] = ["--command-packages", "", "build"] |
---|
165 | n/a | d = self.create_distribution([TESTFN]) |
---|
166 | n/a | self.assertEqual(d.get_command_packages(), ["distutils.command"]) |
---|
167 | n/a | |
---|
168 | n/a | def test_empty_options(self): |
---|
169 | n/a | # an empty options dictionary should not stay in the |
---|
170 | n/a | # list of attributes |
---|
171 | n/a | |
---|
172 | n/a | # catching warnings |
---|
173 | n/a | warns = [] |
---|
174 | n/a | |
---|
175 | n/a | def _warn(msg): |
---|
176 | n/a | warns.append(msg) |
---|
177 | n/a | |
---|
178 | n/a | self.addCleanup(setattr, warnings, 'warn', warnings.warn) |
---|
179 | n/a | warnings.warn = _warn |
---|
180 | n/a | dist = Distribution(attrs={'author': 'xxx', 'name': 'xxx', |
---|
181 | n/a | 'version': 'xxx', 'url': 'xxxx', |
---|
182 | n/a | 'options': {}}) |
---|
183 | n/a | |
---|
184 | n/a | self.assertEqual(len(warns), 0) |
---|
185 | n/a | self.assertNotIn('options', dir(dist)) |
---|
186 | n/a | |
---|
187 | n/a | def test_finalize_options(self): |
---|
188 | n/a | attrs = {'keywords': 'one,two', |
---|
189 | n/a | 'platforms': 'one,two'} |
---|
190 | n/a | |
---|
191 | n/a | dist = Distribution(attrs=attrs) |
---|
192 | n/a | dist.finalize_options() |
---|
193 | n/a | |
---|
194 | n/a | # finalize_option splits platforms and keywords |
---|
195 | n/a | self.assertEqual(dist.metadata.platforms, ['one', 'two']) |
---|
196 | n/a | self.assertEqual(dist.metadata.keywords, ['one', 'two']) |
---|
197 | n/a | |
---|
198 | n/a | def test_get_command_packages(self): |
---|
199 | n/a | dist = Distribution() |
---|
200 | n/a | self.assertEqual(dist.command_packages, None) |
---|
201 | n/a | cmds = dist.get_command_packages() |
---|
202 | n/a | self.assertEqual(cmds, ['distutils.command']) |
---|
203 | n/a | self.assertEqual(dist.command_packages, |
---|
204 | n/a | ['distutils.command']) |
---|
205 | n/a | |
---|
206 | n/a | dist.command_packages = 'one,two' |
---|
207 | n/a | cmds = dist.get_command_packages() |
---|
208 | n/a | self.assertEqual(cmds, ['distutils.command', 'one', 'two']) |
---|
209 | n/a | |
---|
210 | n/a | def test_announce(self): |
---|
211 | n/a | # make sure the level is known |
---|
212 | n/a | dist = Distribution() |
---|
213 | n/a | args = ('ok',) |
---|
214 | n/a | kwargs = {'level': 'ok2'} |
---|
215 | n/a | self.assertRaises(ValueError, dist.announce, args, kwargs) |
---|
216 | n/a | |
---|
217 | n/a | |
---|
218 | n/a | def test_find_config_files_disable(self): |
---|
219 | n/a | # Ticket #1180: Allow user to disable their home config file. |
---|
220 | n/a | temp_home = self.mkdtemp() |
---|
221 | n/a | if os.name == 'posix': |
---|
222 | n/a | user_filename = os.path.join(temp_home, ".pydistutils.cfg") |
---|
223 | n/a | else: |
---|
224 | n/a | user_filename = os.path.join(temp_home, "pydistutils.cfg") |
---|
225 | n/a | |
---|
226 | n/a | with open(user_filename, 'w') as f: |
---|
227 | n/a | f.write('[distutils]\n') |
---|
228 | n/a | |
---|
229 | n/a | def _expander(path): |
---|
230 | n/a | return temp_home |
---|
231 | n/a | |
---|
232 | n/a | old_expander = os.path.expanduser |
---|
233 | n/a | os.path.expanduser = _expander |
---|
234 | n/a | try: |
---|
235 | n/a | d = Distribution() |
---|
236 | n/a | all_files = d.find_config_files() |
---|
237 | n/a | |
---|
238 | n/a | d = Distribution(attrs={'script_args': ['--no-user-cfg']}) |
---|
239 | n/a | files = d.find_config_files() |
---|
240 | n/a | finally: |
---|
241 | n/a | os.path.expanduser = old_expander |
---|
242 | n/a | |
---|
243 | n/a | # make sure --no-user-cfg disables the user cfg file |
---|
244 | n/a | self.assertEqual(len(all_files)-1, len(files)) |
---|
245 | n/a | |
---|
246 | n/a | class MetadataTestCase(support.TempdirManager, support.EnvironGuard, |
---|
247 | n/a | unittest.TestCase): |
---|
248 | n/a | |
---|
249 | n/a | def setUp(self): |
---|
250 | n/a | super(MetadataTestCase, self).setUp() |
---|
251 | n/a | self.argv = sys.argv, sys.argv[:] |
---|
252 | n/a | |
---|
253 | n/a | def tearDown(self): |
---|
254 | n/a | sys.argv = self.argv[0] |
---|
255 | n/a | sys.argv[:] = self.argv[1] |
---|
256 | n/a | super(MetadataTestCase, self).tearDown() |
---|
257 | n/a | |
---|
258 | n/a | def format_metadata(self, dist): |
---|
259 | n/a | sio = io.StringIO() |
---|
260 | n/a | dist.metadata.write_pkg_file(sio) |
---|
261 | n/a | return sio.getvalue() |
---|
262 | n/a | |
---|
263 | n/a | def test_simple_metadata(self): |
---|
264 | n/a | attrs = {"name": "package", |
---|
265 | n/a | "version": "1.0"} |
---|
266 | n/a | dist = Distribution(attrs) |
---|
267 | n/a | meta = self.format_metadata(dist) |
---|
268 | n/a | self.assertIn("Metadata-Version: 1.0", meta) |
---|
269 | n/a | self.assertNotIn("provides:", meta.lower()) |
---|
270 | n/a | self.assertNotIn("requires:", meta.lower()) |
---|
271 | n/a | self.assertNotIn("obsoletes:", meta.lower()) |
---|
272 | n/a | |
---|
273 | n/a | def test_provides(self): |
---|
274 | n/a | attrs = {"name": "package", |
---|
275 | n/a | "version": "1.0", |
---|
276 | n/a | "provides": ["package", "package.sub"]} |
---|
277 | n/a | dist = Distribution(attrs) |
---|
278 | n/a | self.assertEqual(dist.metadata.get_provides(), |
---|
279 | n/a | ["package", "package.sub"]) |
---|
280 | n/a | self.assertEqual(dist.get_provides(), |
---|
281 | n/a | ["package", "package.sub"]) |
---|
282 | n/a | meta = self.format_metadata(dist) |
---|
283 | n/a | self.assertIn("Metadata-Version: 1.1", meta) |
---|
284 | n/a | self.assertNotIn("requires:", meta.lower()) |
---|
285 | n/a | self.assertNotIn("obsoletes:", meta.lower()) |
---|
286 | n/a | |
---|
287 | n/a | def test_provides_illegal(self): |
---|
288 | n/a | self.assertRaises(ValueError, Distribution, |
---|
289 | n/a | {"name": "package", |
---|
290 | n/a | "version": "1.0", |
---|
291 | n/a | "provides": ["my.pkg (splat)"]}) |
---|
292 | n/a | |
---|
293 | n/a | def test_requires(self): |
---|
294 | n/a | attrs = {"name": "package", |
---|
295 | n/a | "version": "1.0", |
---|
296 | n/a | "requires": ["other", "another (==1.0)"]} |
---|
297 | n/a | dist = Distribution(attrs) |
---|
298 | n/a | self.assertEqual(dist.metadata.get_requires(), |
---|
299 | n/a | ["other", "another (==1.0)"]) |
---|
300 | n/a | self.assertEqual(dist.get_requires(), |
---|
301 | n/a | ["other", "another (==1.0)"]) |
---|
302 | n/a | meta = self.format_metadata(dist) |
---|
303 | n/a | self.assertIn("Metadata-Version: 1.1", meta) |
---|
304 | n/a | self.assertNotIn("provides:", meta.lower()) |
---|
305 | n/a | self.assertIn("Requires: other", meta) |
---|
306 | n/a | self.assertIn("Requires: another (==1.0)", meta) |
---|
307 | n/a | self.assertNotIn("obsoletes:", meta.lower()) |
---|
308 | n/a | |
---|
309 | n/a | def test_requires_illegal(self): |
---|
310 | n/a | self.assertRaises(ValueError, Distribution, |
---|
311 | n/a | {"name": "package", |
---|
312 | n/a | "version": "1.0", |
---|
313 | n/a | "requires": ["my.pkg (splat)"]}) |
---|
314 | n/a | |
---|
315 | n/a | def test_obsoletes(self): |
---|
316 | n/a | attrs = {"name": "package", |
---|
317 | n/a | "version": "1.0", |
---|
318 | n/a | "obsoletes": ["other", "another (<1.0)"]} |
---|
319 | n/a | dist = Distribution(attrs) |
---|
320 | n/a | self.assertEqual(dist.metadata.get_obsoletes(), |
---|
321 | n/a | ["other", "another (<1.0)"]) |
---|
322 | n/a | self.assertEqual(dist.get_obsoletes(), |
---|
323 | n/a | ["other", "another (<1.0)"]) |
---|
324 | n/a | meta = self.format_metadata(dist) |
---|
325 | n/a | self.assertIn("Metadata-Version: 1.1", meta) |
---|
326 | n/a | self.assertNotIn("provides:", meta.lower()) |
---|
327 | n/a | self.assertNotIn("requires:", meta.lower()) |
---|
328 | n/a | self.assertIn("Obsoletes: other", meta) |
---|
329 | n/a | self.assertIn("Obsoletes: another (<1.0)", meta) |
---|
330 | n/a | |
---|
331 | n/a | def test_obsoletes_illegal(self): |
---|
332 | n/a | self.assertRaises(ValueError, Distribution, |
---|
333 | n/a | {"name": "package", |
---|
334 | n/a | "version": "1.0", |
---|
335 | n/a | "obsoletes": ["my.pkg (splat)"]}) |
---|
336 | n/a | |
---|
337 | n/a | def test_classifier(self): |
---|
338 | n/a | attrs = {'name': 'Boa', 'version': '3.0', |
---|
339 | n/a | 'classifiers': ['Programming Language :: Python :: 3']} |
---|
340 | n/a | dist = Distribution(attrs) |
---|
341 | n/a | meta = self.format_metadata(dist) |
---|
342 | n/a | self.assertIn('Metadata-Version: 1.1', meta) |
---|
343 | n/a | |
---|
344 | n/a | def test_download_url(self): |
---|
345 | n/a | attrs = {'name': 'Boa', 'version': '3.0', |
---|
346 | n/a | 'download_url': 'http://example.org/boa'} |
---|
347 | n/a | dist = Distribution(attrs) |
---|
348 | n/a | meta = self.format_metadata(dist) |
---|
349 | n/a | self.assertIn('Metadata-Version: 1.1', meta) |
---|
350 | n/a | |
---|
351 | n/a | def test_long_description(self): |
---|
352 | n/a | long_desc = textwrap.dedent("""\ |
---|
353 | n/a | example:: |
---|
354 | n/a | We start here |
---|
355 | n/a | and continue here |
---|
356 | n/a | and end here.""") |
---|
357 | n/a | attrs = {"name": "package", |
---|
358 | n/a | "version": "1.0", |
---|
359 | n/a | "long_description": long_desc} |
---|
360 | n/a | |
---|
361 | n/a | dist = Distribution(attrs) |
---|
362 | n/a | meta = self.format_metadata(dist) |
---|
363 | n/a | meta = meta.replace('\n' + 8 * ' ', '\n') |
---|
364 | n/a | self.assertIn(long_desc, meta) |
---|
365 | n/a | |
---|
366 | n/a | def test_custom_pydistutils(self): |
---|
367 | n/a | # fixes #2166 |
---|
368 | n/a | # make sure pydistutils.cfg is found |
---|
369 | n/a | if os.name == 'posix': |
---|
370 | n/a | user_filename = ".pydistutils.cfg" |
---|
371 | n/a | else: |
---|
372 | n/a | user_filename = "pydistutils.cfg" |
---|
373 | n/a | |
---|
374 | n/a | temp_dir = self.mkdtemp() |
---|
375 | n/a | user_filename = os.path.join(temp_dir, user_filename) |
---|
376 | n/a | f = open(user_filename, 'w') |
---|
377 | n/a | try: |
---|
378 | n/a | f.write('.') |
---|
379 | n/a | finally: |
---|
380 | n/a | f.close() |
---|
381 | n/a | |
---|
382 | n/a | try: |
---|
383 | n/a | dist = Distribution() |
---|
384 | n/a | |
---|
385 | n/a | # linux-style |
---|
386 | n/a | if sys.platform in ('linux', 'darwin'): |
---|
387 | n/a | os.environ['HOME'] = temp_dir |
---|
388 | n/a | files = dist.find_config_files() |
---|
389 | n/a | self.assertIn(user_filename, files) |
---|
390 | n/a | |
---|
391 | n/a | # win32-style |
---|
392 | n/a | if sys.platform == 'win32': |
---|
393 | n/a | # home drive should be found |
---|
394 | n/a | os.environ['HOME'] = temp_dir |
---|
395 | n/a | files = dist.find_config_files() |
---|
396 | n/a | self.assertIn(user_filename, files, |
---|
397 | n/a | '%r not found in %r' % (user_filename, files)) |
---|
398 | n/a | finally: |
---|
399 | n/a | os.remove(user_filename) |
---|
400 | n/a | |
---|
401 | n/a | def test_fix_help_options(self): |
---|
402 | n/a | help_tuples = [('a', 'b', 'c', 'd'), (1, 2, 3, 4)] |
---|
403 | n/a | fancy_options = fix_help_options(help_tuples) |
---|
404 | n/a | self.assertEqual(fancy_options[0], ('a', 'b', 'c')) |
---|
405 | n/a | self.assertEqual(fancy_options[1], (1, 2, 3)) |
---|
406 | n/a | |
---|
407 | n/a | def test_show_help(self): |
---|
408 | n/a | # smoke test, just makes sure some help is displayed |
---|
409 | n/a | self.addCleanup(log.set_threshold, log._global_log.threshold) |
---|
410 | n/a | dist = Distribution() |
---|
411 | n/a | sys.argv = [] |
---|
412 | n/a | dist.help = 1 |
---|
413 | n/a | dist.script_name = 'setup.py' |
---|
414 | n/a | with captured_stdout() as s: |
---|
415 | n/a | dist.parse_command_line() |
---|
416 | n/a | |
---|
417 | n/a | output = [line for line in s.getvalue().split('\n') |
---|
418 | n/a | if line.strip() != ''] |
---|
419 | n/a | self.assertTrue(output) |
---|
420 | n/a | |
---|
421 | n/a | |
---|
422 | n/a | def test_read_metadata(self): |
---|
423 | n/a | attrs = {"name": "package", |
---|
424 | n/a | "version": "1.0", |
---|
425 | n/a | "long_description": "desc", |
---|
426 | n/a | "description": "xxx", |
---|
427 | n/a | "download_url": "http://example.com", |
---|
428 | n/a | "keywords": ['one', 'two'], |
---|
429 | n/a | "requires": ['foo']} |
---|
430 | n/a | |
---|
431 | n/a | dist = Distribution(attrs) |
---|
432 | n/a | metadata = dist.metadata |
---|
433 | n/a | |
---|
434 | n/a | # write it then reloads it |
---|
435 | n/a | PKG_INFO = io.StringIO() |
---|
436 | n/a | metadata.write_pkg_file(PKG_INFO) |
---|
437 | n/a | PKG_INFO.seek(0) |
---|
438 | n/a | metadata.read_pkg_file(PKG_INFO) |
---|
439 | n/a | |
---|
440 | n/a | self.assertEqual(metadata.name, "package") |
---|
441 | n/a | self.assertEqual(metadata.version, "1.0") |
---|
442 | n/a | self.assertEqual(metadata.description, "xxx") |
---|
443 | n/a | self.assertEqual(metadata.download_url, 'http://example.com') |
---|
444 | n/a | self.assertEqual(metadata.keywords, ['one', 'two']) |
---|
445 | n/a | self.assertEqual(metadata.platforms, ['UNKNOWN']) |
---|
446 | n/a | self.assertEqual(metadata.obsoletes, None) |
---|
447 | n/a | self.assertEqual(metadata.requires, ['foo']) |
---|
448 | n/a | |
---|
449 | n/a | def test_suite(): |
---|
450 | n/a | suite = unittest.TestSuite() |
---|
451 | n/a | suite.addTest(unittest.makeSuite(DistributionTestCase)) |
---|
452 | n/a | suite.addTest(unittest.makeSuite(MetadataTestCase)) |
---|
453 | n/a | return suite |
---|
454 | n/a | |
---|
455 | n/a | if __name__ == "__main__": |
---|
456 | n/a | run_unittest(test_suite()) |
---|