diff options
| author | Konrad Delong <konryd@gmail.com> | 2010-08-15 11:51:48 +0200 |
|---|---|---|
| committer | Konrad Delong <konryd@gmail.com> | 2010-08-15 11:51:48 +0200 |
| commit | 76af9b72929f635b2e74a670ee7e1b7c0ca19c31 (patch) | |
| tree | ee219932cb569ec7760ca1b34e66504875b3036b /src/distutils2 | |
| parent | 298a546dec41433d8d6004ca29de4ceb3bbfac8a (diff) | |
| download | disutils2-76af9b72929f635b2e74a670ee7e1b7c0ca19c31.tar.gz | |
changed warning to user announcement
Diffstat (limited to 'src/distutils2')
| -rw-r--r-- | src/distutils2/command/test.py | 6 | ||||
| -rw-r--r-- | src/distutils2/tests/test_test.py | 11 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/distutils2/command/test.py b/src/distutils2/command/test.py index f93c228..9e2d307 100644 --- a/src/distutils2/command/test.py +++ b/src/distutils2/command/test.py @@ -1,7 +1,6 @@ import os import sys import unittest -import warnings from distutils2 import log from distutils2.core import Command @@ -34,10 +33,9 @@ class test(Command): self.build_lib = self.get_finalized_command("build").build_lib for requirement in self.tests_require: if get_distribution(requirement) is None: - warnings.warn("The test dependency %s is not installed which may couse the tests to fail." % requirement, - RuntimeWarning) + self.announce("The test dependency %s is not installed which may couse the tests to fail." % requirement) if not self.suite and not self.runner and self.get_ut_with_discovery() is None: - self.announce("No test discovery available. Please specify the 'suite' or 'runner' option or install unittest2.", log.ERROR) + raise DistutilsOptionError("No test discovery available. Please specify the 'suite' or 'runner' option or install unittest2.") def get_ut_with_discovery(self): if hasattr(unittest.TestLoader, "discover"): diff --git a/src/distutils2/tests/test_test.py b/src/distutils2/tests/test_test.py index ab18ef6..5b5f7b1 100644 --- a/src/distutils2/tests/test_test.py +++ b/src/distutils2/tests/test_test.py @@ -3,7 +3,6 @@ import re import sys import shutil import subprocess -import warnings from copy import copy from os.path import join @@ -120,14 +119,16 @@ class TestTest(TempdirManager, def _test_works_with_2to3(self): pass - @unittest.skipUnless(sys.version > '2.6', 'Need >= 2.6') def test_checks_requires(self): dist = Distribution() cmd = test(dist) - cmd.tests_require = ['ohno_ohno-impossible_1234-name_stop-that!'] + phony_project = 'ohno_ohno-impossible_1234-name_stop-that!' + cmd.tests_require = [phony_project] + record = [] + cmd.announce = lambda *args: record.append(args) cmd.ensure_finalized() - self.assertEqual(1, len(self.warnings)) - self.assertIs(self.warnings[0]["category"], RuntimeWarning) + self.assertEqual(1, len(record)) + self.assertIn(phony_project, record[0][0]) def test_custom_runner(self): dist = Distribution() |
