summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2016-06-24 08:48:27 +0300
committerBerker Peksag <berker.peksag@gmail.com>2016-06-24 08:48:27 +0300
commit90d7e0e1b1e1da326f73d4dbdc81e9a4e72daa5c (patch)
tree76be7777973c4211b2fddda582c6a7051fad5fa2
parent32821f0c7684148df899f79932c2e138c3ace6f5 (diff)
downloadpython-setuptools-git-90d7e0e1b1e1da326f73d4dbdc81e9a4e72daa5c.tar.gz
Make PyPIRCCommandTestCase derive from a base class
Several test cases in distutils use PyPIRCCommandTestCase as their base class and as a result of that the following tests were ran more than once: * test_server_registration * test_server_empty_registration * test_config_interpolation This commit moves the infrastructure used by other tests into a new BasePyPIRCCommandTestCase class.
-rw-r--r--tests/test_config.py9
-rw-r--r--tests/test_register.py4
-rw-r--r--tests/test_sdist.py4
-rw-r--r--tests/test_upload.py4
4 files changed, 12 insertions, 9 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
index 0b91d19a..3dd92d61 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -52,14 +52,14 @@ password:xxx
"""
-class PyPIRCCommandTestCase(support.TempdirManager,
+class BasePyPIRCCommandTestCase(support.TempdirManager,
support.LoggingSilencer,
support.EnvironGuard,
unittest.TestCase):
def setUp(self):
"""Patches the environment."""
- super(PyPIRCCommandTestCase, self).setUp()
+ super(BasePyPIRCCommandTestCase, self).setUp()
self.tmp_dir = self.mkdtemp()
os.environ['HOME'] = self.tmp_dir
self.rc = os.path.join(self.tmp_dir, '.pypirc')
@@ -78,7 +78,10 @@ class PyPIRCCommandTestCase(support.TempdirManager,
def tearDown(self):
"""Removes the patch."""
set_threshold(self.old_threshold)
- super(PyPIRCCommandTestCase, self).tearDown()
+ super(BasePyPIRCCommandTestCase, self).tearDown()
+
+
+class PyPIRCCommandTestCase(BasePyPIRCCommandTestCase):
def test_server_registration(self):
# This test makes sure PyPIRCCommand knows how to:
diff --git a/tests/test_register.py b/tests/test_register.py
index 01acf237..e68b0af3 100644
--- a/tests/test_register.py
+++ b/tests/test_register.py
@@ -12,7 +12,7 @@ from distutils.command.register import register
from distutils.errors import DistutilsSetupError
from distutils.log import INFO
-from distutils.tests.test_config import PyPIRCCommandTestCase
+from distutils.tests.test_config import BasePyPIRCCommandTestCase
try:
import docutils
@@ -72,7 +72,7 @@ class FakeOpener(object):
}.get(name.lower(), default)
-class RegisterTestCase(PyPIRCCommandTestCase):
+class RegisterTestCase(BasePyPIRCCommandTestCase):
def setUp(self):
super(RegisterTestCase, self).setUp()
diff --git a/tests/test_sdist.py b/tests/test_sdist.py
index 5a04e0dd..5444b815 100644
--- a/tests/test_sdist.py
+++ b/tests/test_sdist.py
@@ -23,7 +23,7 @@ except ImportError:
from distutils.command.sdist import sdist, show_formats
from distutils.core import Distribution
-from distutils.tests.test_config import PyPIRCCommandTestCase
+from distutils.tests.test_config import BasePyPIRCCommandTestCase
from distutils.errors import DistutilsOptionError
from distutils.spawn import find_executable
from distutils.log import WARN
@@ -52,7 +52,7 @@ somecode%(sep)sdoc.dat
somecode%(sep)sdoc.txt
"""
-class SDistTestCase(PyPIRCCommandTestCase):
+class SDistTestCase(BasePyPIRCCommandTestCase):
def setUp(self):
# PyPIRCCommandTestCase creates a temp dir already
diff --git a/tests/test_upload.py b/tests/test_upload.py
index 3eecf8af..e836cc49 100644
--- a/tests/test_upload.py
+++ b/tests/test_upload.py
@@ -12,7 +12,7 @@ from distutils.core import Distribution
from distutils.errors import DistutilsError
from distutils.log import ERROR, INFO
-from distutils.tests.test_config import PYPIRC, PyPIRCCommandTestCase
+from distutils.tests.test_config import PYPIRC, BasePyPIRCCommandTestCase
PYPIRC_LONG_PASSWORD = """\
[distutils]
@@ -66,7 +66,7 @@ class FakeOpen(object):
return self.code
-class uploadTestCase(PyPIRCCommandTestCase):
+class uploadTestCase(BasePyPIRCCommandTestCase):
def setUp(self):
super(uploadTestCase, self).setUp()