diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-27 15:00:08 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-27 15:00:08 -0500 |
commit | f8c923f27aa52c5447d8669e8246e3cc27282e21 (patch) | |
tree | 6949a5e5cbdefbcf9f99fbe5cc24e0c23400ffa2 | |
parent | 074413b0804d00a6d1d62bad5b12fdef92291aeb (diff) | |
download | external_python_setuptools-f8c923f27aa52c5447d8669e8246e3cc27282e21.tar.gz external_python_setuptools-f8c923f27aa52c5447d8669e8246e3cc27282e21.tar.bz2 external_python_setuptools-f8c923f27aa52c5447d8669e8246e3cc27282e21.zip |
Move the global import logic for test_multiproc_atexit into the test where it is used.
-rw-r--r-- | setuptools/tests/test_easy_install.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 24436d70..a90ae23f 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -9,6 +9,7 @@ import site import contextlib import textwrap import tarfile +import logging import distutils.core from setuptools.compat import StringIO, BytesIO, next, urlparse @@ -21,17 +22,6 @@ from setuptools.dist import Distribution from pkg_resources import Distribution as PRDistribution import setuptools.tests.server -try: - # import multiprocessing solely for the purpose of testing its existence - __import__('multiprocessing') - import logging - _LOG = logging.getLogger('test_easy_install') - logging.basicConfig(level=logging.INFO, stream=sys.stderr) - _MULTIPROC = True -except ImportError: - _MULTIPROC = False - _LOG = None - class FakeDist(object): def get_entry_map(self, group): if group != 'console_scripts': @@ -171,9 +161,15 @@ class TestUserInstallTest(unittest.TestCase): self.assertTrue(cmd.user, 'user should be implied') def test_multiproc_atexit(self): - if not _MULTIPROC: + try: + __import__('multiprocessing') + except ImportError: + # skip the test if multiprocessing is not available return - _LOG.info('this should not break') + + log = logging.getLogger('test_easy_install') + logging.basicConfig(level=logging.INFO, stream=sys.stderr) + log.info('this should not break') def test_user_install_not_implied_without_usersite_enabled(self): site.ENABLE_USER_SITE = False # usually enabled |