diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2016-10-18 11:11:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-18 11:11:59 -0400 |
commit | 7d984bbdc111fcdfef816265e159a3054dbee132 (patch) | |
tree | 3a25ce5765a8c9ae633a3eaeec1ce88f7b382e21 | |
parent | f774a0be095c3873c2881d393605fefa5ca0d0d6 (diff) | |
parent | 31bd37c6ac8de9e8c1bacebc2d8e1215df91eb96 (diff) | |
download | external_python_setuptools-7d984bbdc111fcdfef816265e159a3054dbee132.tar.gz external_python_setuptools-7d984bbdc111fcdfef816265e159a3054dbee132.tar.bz2 external_python_setuptools-7d984bbdc111fcdfef816265e159a3054dbee132.zip |
Merge pull request #820 from stepshal/blank
Fix quantity of blank lines.
45 files changed, 48 insertions, 88 deletions
diff --git a/bootstrap.py b/bootstrap.py index bf7fb431..c5f470a4 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -10,7 +10,6 @@ import sys import textwrap import subprocess - minimal_egg_info = textwrap.dedent(""" [distutils.commands] egg_info = setuptools.command.egg_info:egg_info diff --git a/docs/conf.py b/docs/conf.py index dc0d8fae..fae8e632 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,7 +60,6 @@ exclude_trees = [] # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' - # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with @@ -93,7 +92,6 @@ html_use_index = False # Output file base name for HTML help builder. htmlhelp_basename = 'Setuptoolsdoc' - # -- Options for LaTeX output -------------------------------------------------- # Grouping the document tree into LaTeX files. List of tuples diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 33b3f56c..12226d4b 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ Package resource API -------------------- @@ -74,7 +73,6 @@ __import__('pkg_resources.extern.packaging.specifiers') __import__('pkg_resources.extern.packaging.requirements') __import__('pkg_resources.extern.packaging.markers') - if (3, 0) < sys.version_info < (3, 3): msg = ( "Support for Python 3.0-3.2 has been dropped. Future versions " @@ -96,7 +94,6 @@ class PEP440Warning(RuntimeWarning): class _SetuptoolsVersionMixin(object): - def __hash__(self): return super(_SetuptoolsVersionMixin, self).__hash__() @@ -578,7 +575,6 @@ def get_entry_info(dist, group, name): class IMetadataProvider: - def has_metadata(name): """Does the package's distribution contain the named metadata?""" @@ -2738,7 +2734,6 @@ class Distribution(object): class EggInfoDistribution(Distribution): - def _reload_version(self): """ Packages installed by distutils (e.g. numpy or scipy), @@ -2825,7 +2820,6 @@ def issue_warning(*args, **kw): class RequirementParseError(ValueError): - def __str__(self): return ' '.join(self.args) @@ -2850,7 +2844,6 @@ def parse_requirements(strs): class Requirement(packaging.requirements.Requirement): - def __init__(self, requirement_string): """DO NOT CALL THIS UNDOCUMENTED METHOD; use Requirement.parse()!""" try: @@ -2906,8 +2899,10 @@ class Requirement(packaging.requirements.Requirement): def _get_mro(cls): """Get an mro for a type or classic class""" if not isinstance(cls, type): + class cls(cls, object): pass + return cls.__mro__[1:] return cls.__mro__ diff --git a/pkg_resources/tests/test_pkg_resources.py b/pkg_resources/tests/test_pkg_resources.py index 361fe657..49bf7a04 100644 --- a/pkg_resources/tests/test_pkg_resources.py +++ b/pkg_resources/tests/test_pkg_resources.py @@ -18,7 +18,6 @@ import pytest import pkg_resources - try: unicode except NameError: @@ -37,7 +36,6 @@ def timestamp(dt): class EggRemover(unicode): - def __call__(self): if self in sys.path: sys.path.remove(self) @@ -100,7 +98,6 @@ class TestZipProvider(object): class TestResourceManager(object): - def test_get_cache_path(self): mgr = pkg_resources.ResourceManager() path = mgr.get_cache_path('foo') @@ -130,13 +127,13 @@ class TestIndependence: class TestDeepVersionLookupDistutils(object): - @pytest.fixture def env(self, tmpdir): """ Create a package environment, similar to a virtualenv, in which packages are installed. """ + class Environment(str): pass diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index 3b13884b..00ca7426 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -36,7 +36,6 @@ dist_from_fn = pkg_resources.Distribution.from_filename class TestDistro: - def testCollection(self): # empty path should produce no distributions ad = pkg_resources.Environment([], platform=None, python=None) @@ -313,7 +312,6 @@ class TestDistro: class TestWorkingSet: - def test_find_conflicting(self): ws = WorkingSet([]) Foo = Distribution.from_filename("/foo_dir/Foo-1.2.egg") @@ -356,7 +354,6 @@ class TestWorkingSet: class TestEntryPoints: - def assertfields(self, ep): assert ep.name == "foo" assert ep.module_name == "pkg_resources.tests.test_resources" @@ -457,7 +454,6 @@ class TestEntryPoints: class TestRequirements: - def testBasics(self): r = Requirement.parse("Twisted>=1.2") assert str(r) == "Twisted>=1.2" @@ -538,7 +534,6 @@ class TestRequirements: class TestParsing: - def testEmptyParse(self): assert list(parse_requirements('')) == [] @@ -701,6 +696,7 @@ class TestParsing: value of parse_version. The new parse_version returns a Version class which needs to support this behavior, at least for now. """ + def buildout(parsed_version): _final_parts = '*final-', '*final' @@ -709,6 +705,7 @@ class TestParsing: if (part[:1] == '*') and (part not in _final_parts): return False return True + return _final_version(parsed_version) assert buildout(parse_version("1.0")) @@ -10,7 +10,6 @@ import textwrap import setuptools - here = os.path.dirname(__file__) @@ -97,11 +96,8 @@ setup_params = dict( src_root=None, packages=setuptools.find_packages(exclude=['*.tests']), package_data=package_data, - py_modules=['easy_install'], - zip_safe=True, - entry_points={ "distutils.commands": [ "%(cmd)s = setuptools.command.%(cmd)s:%(cmd)s" % locals() @@ -141,12 +137,9 @@ setup_params = dict( "dependency_links.txt = setuptools.command.egg_info:overwrite_arg", ], "console_scripts": list(_gen_console_scripts()), - "setuptools.installation": ['eggsecutable = setuptools.command.easy_install:bootstrap'], }, - - classifiers=textwrap.dedent(""" Development Status :: 5 - Production/Stable Intended Audience :: Developers diff --git a/setuptools/__init__.py b/setuptools/__init__.py index baec3884..54577ced 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -102,7 +102,6 @@ class PackageFinder(object): class PEP420PackageFinder(PackageFinder): - @staticmethod def _looks_like_package(path): return True diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index b6411cc5..cc82b3da 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -10,7 +10,6 @@ from distutils.errors import DistutilsError from pkg_resources import ensure_directory, ContextualZipFile - __all__ = [ "unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_filter", "UnrecognizedFormat", "extraction_drivers", "unpack_directory", diff --git a/setuptools/command/__init__.py b/setuptools/command/__init__.py index 3fb2f6df..efbe9411 100644 --- a/setuptools/command/__init__.py +++ b/setuptools/command/__init__.py @@ -10,7 +10,6 @@ import sys from setuptools.command import install_scripts - if 'egg' not in bdist.format_commands: bdist.format_command['egg'] = ('bdist_egg', "Python .egg file") bdist.format_commands.append('egg') diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index cbea7537..8cd9dfef 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -429,10 +429,10 @@ def can_scan(): log.warn("Please ask the author to include a 'zip_safe'" " setting (either True or False) in the package's setup.py") + # Attribute names of options for commands that might need to be convinced to # install to the egg build directory - INSTALL_DIRECTORY_ATTRS = [ 'install_lib', 'install_dir', 'install_data', 'install_base' ] diff --git a/setuptools/command/bdist_wininst.py b/setuptools/command/bdist_wininst.py index 8243c917..073de97b 100755 --- a/setuptools/command/bdist_wininst.py +++ b/setuptools/command/bdist_wininst.py @@ -2,7 +2,6 @@ import distutils.command.bdist_wininst as orig class bdist_wininst(orig.bdist_wininst): - def reinitialize_command(self, command, reinit_subcommands=0): """ Supplement reinitialize_command to work around diff --git a/setuptools/command/build_ext.py b/setuptools/command/build_ext.py index 454c91fb..12dc88cd 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -56,7 +56,6 @@ elif os.name != 'nt': except ImportError: pass - if_dl = lambda s: s if have_rtld else '' @@ -70,7 +69,6 @@ def get_abi3_suffix(): class build_ext(_build_ext): - def run(self): """Build extensions in build directory, then copy if --inplace""" old_inplace, self.inplace = self.inplace, 0 diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index a3792ce2..03dd6768 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1,5 +1,4 @@ #!/usr/bin/env python - """ Easy Install ------------ @@ -64,7 +63,6 @@ import pkg_resources # Turn on PEP440Warnings warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) - __all__ = [ 'samefile', 'easy_install', 'PthDistributions', 'extract_wininst_cfg', 'main', 'get_exe_prefixes', @@ -92,6 +90,7 @@ def samefile(p1, p2): if six.PY2: + def _to_ascii(s): return s @@ -102,6 +101,7 @@ if six.PY2: except UnicodeError: return False else: + def _to_ascii(s): return s.encode('ascii') @@ -1632,7 +1632,6 @@ class PthDistributions(Environment): class RewritePthDistributions(PthDistributions): - @classmethod def _wrap_lines(cls, lines): yield cls.prelude @@ -1837,6 +1836,7 @@ if '__pypy__' in sys.builtin_module_names: _replace_zip_directory_cache_data = \ _remove_and_clear_zip_directory_cache_data else: + def _replace_zip_directory_cache_data(normalized_path): def replace_cached_zip_archive_directory_data(path, old_entry): # N.B. In theory, we could load the zip directory information just @@ -2164,7 +2164,6 @@ class WindowsScriptWriter(ScriptWriter): class WindowsExecutableLauncherWriter(WindowsScriptWriter): - @classmethod def _get_script_args(cls, type_, name, header, script_text): """ diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index b85d7d03..9975753d 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -89,8 +89,10 @@ class sdist(sdist_add_defaults, orig.sdist): """ In a context, remove and restore os.link if it exists """ + class NoValue: pass + orig_val = getattr(os, 'link', NoValue) try: del os.link diff --git a/setuptools/command/setopt.py b/setuptools/command/setopt.py index 7f332be5..7e57cc02 100755 --- a/setuptools/command/setopt.py +++ b/setuptools/command/setopt.py @@ -8,7 +8,6 @@ from setuptools.extern.six.moves import configparser from setuptools import Command - __all__ = ['config_file', 'edit_config', 'option_base', 'setopt'] diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 38bbcd8b..270674e2 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -17,7 +17,6 @@ from setuptools.py31compat import unittest_main class ScanningLoader(TestLoader): - def loadTestsFromModule(self, module, pattern=None): """Return a suite of all tests cases contained in the given module @@ -50,7 +49,6 @@ class ScanningLoader(TestLoader): # adapted from jaraco.classes.properties:NonDataProperty class NonDataProperty(object): - def __init__(self, fget): self.fget = fget diff --git a/setuptools/extension.py b/setuptools/extension.py index 03068d35..29468894 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -26,7 +26,6 @@ def _have_cython(): # for compatibility have_pyrex = _have_cython - _Extension = get_unpatched(distutils.core.Extension) diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index 6859aa5b..2cd08b7e 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -1,5 +1,4 @@ from pkg_resources.extern import VendorImporter - names = 'six', VendorImporter(__name__, names, 'pkg_resources._vendor').install() diff --git a/setuptools/glob.py b/setuptools/glob.py index f51b9c83..6c781de3 100644 --- a/setuptools/glob.py +++ b/setuptools/glob.py @@ -14,6 +14,7 @@ from setuptools.extern.six import binary_type __all__ = ["glob", "iglob", "escape"] + def glob(pathname, recursive=False): """Return a list of paths matching a pathname pattern. @@ -27,6 +28,7 @@ def glob(pathname, recursive=False): """ return list(iglob(pathname, recursive=recursive)) + def iglob(pathname, recursive=False): """Return an iterator which yields the paths matching a pathname pattern. @@ -44,6 +46,7 @@ def iglob(pathname, recursive=False): assert not s return it + def _iglob(pathname, recursive): dirname, basename = os.path.split(pathname) if not has_magic(pathname): @@ -81,10 +84,12 @@ def _iglob(pathname, recursive): for name in glob_in_dir(dirname, basename): yield os.path.join(dirname, name) + # These 2 helper functions non-recursively glob inside a literal directory. # They return a list of basenames. `glob1` accepts a pattern while `glob0` # takes a literal basename (so it only has to check for its existence). + def glob1(dirname, pattern): if not dirname: if isinstance(pattern, binary_type): @@ -97,6 +102,7 @@ def glob1(dirname, pattern): return [] return fnmatch.filter(names, pattern) + def glob0(dirname, basename): if not basename: # `os.path.split()` returns an empty basename for paths ending with a @@ -108,9 +114,11 @@ def glob0(dirname, basename): return [basename] return [] + # This helper function recursively yields relative pathnames inside a literal # directory. + def glob2(dirname, pattern): assert _isrecursive(pattern) yield pattern[:0] @@ -139,6 +147,7 @@ def _rlistdir(dirname): magic_check = re.compile('([*?[])') magic_check_bytes = re.compile(b'([*?[])') + def has_magic(s): if isinstance(s, binary_type): match = magic_check_bytes.search(s) @@ -146,12 +155,14 @@ def has_magic(s): match = magic_check.search(s) return match is not None + def _isrecursive(pattern): if isinstance(pattern, binary_type): return pattern == b'**' else: return pattern == '**' + def escape(pathname): """Escape all special characters. """ diff --git a/setuptools/lib2to3_ex.py b/setuptools/lib2to3_ex.py index c8632bc5..4b1a73fe 100644 --- a/setuptools/lib2to3_ex.py +++ b/setuptools/lib2to3_ex.py @@ -15,7 +15,6 @@ import setuptools class DistutilsRefactoringTool(RefactoringTool): - def log_error(self, msg, *args, **kw): log.error(msg, *args) @@ -27,7 +26,6 @@ class DistutilsRefactoringTool(RefactoringTool): class Mixin2to3(_Mixin2to3): - def run_2to3(self, files, doctests=False): # See of the distribution option has been set, otherwise check the # setuptools default. diff --git a/setuptools/monkey.py b/setuptools/monkey.py index 43b97b4d..aabc280f 100644 --- a/setuptools/monkey.py +++ b/setuptools/monkey.py @@ -13,7 +13,6 @@ from setuptools.extern import six import setuptools - __all__ = [] """ Everything is private. Contact the project team diff --git a/setuptools/msvc.py b/setuptools/msvc.py index e9665e10..ef85f64a 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -34,11 +34,13 @@ else: Mock winreg and environ so the module can be imported on this platform. """ + class winreg: HKEY_USERS = None HKEY_CURRENT_USER = None HKEY_LOCAL_MACHINE = None HKEY_CLASSES_ROOT = None + safe_env = dict() try: @@ -458,6 +460,7 @@ class SystemInfo: vc_ver: float Required Microsoft Visual C++ version. """ + # Variables and properties in this class use originals CamelCase variables # names from Microsoft source files for more easy comparaison. WinDir = safe_env.get('WinDir', '') diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 3e8d6818..3bb97154 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -47,7 +47,6 @@ __all__ = [ _SOCKET_TIMEOUT = 15 - _tmpl = "setuptools/{setuptools.__version__} Python-urllib/{py_major}" user_agent = _tmpl.format(py_major=sys.version[:3], **globals()) @@ -198,9 +197,11 @@ def unique_values(func): Wrap a function returning an iterable such that the resulting iterable only ever yields unique items. """ + @wraps(func) def wrapper(*args, **kwargs): return unique_everseen(func(*args, **kwargs)) + return wrapper @@ -415,6 +416,7 @@ class PackageIndex(Environment): def process_index(self, url, page): """Process the contents of a PyPI page""" + def scan(link): # Process a URL to see if it's for a package page if link.startswith(self.index_url): @@ -946,7 +948,9 @@ def socket_timeout(timeout=15): return func(*args, **kwargs) finally: socket.setdefaulttimeout(old_timeout) + return _socket_timeout + return _socket_timeout @@ -991,7 +995,6 @@ class Credential(object): class PyPIConfig(configparser.RawConfigParser): - def __init__(self): """ Load from ~/.pypirc diff --git a/setuptools/py26compat.py b/setuptools/py26compat.py index 5778cdf1..4d3add8c 100644 --- a/setuptools/py26compat.py +++ b/setuptools/py26compat.py @@ -23,9 +23,9 @@ def strip_fragment(url): if sys.version_info >= (2, 7): strip_fragment = lambda x: x - try: from importlib import import_module except ImportError: + def import_module(module_name): return __import__(module_name, fromlist=['__name__']) diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index 57eb150b..4e3e4ab3 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -13,5 +13,6 @@ def get_all_headers(message, key): if sys.version_info < (3,): + def get_all_headers(message, key): return message.getheaders(key) diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py index 1e959e28..44b025d4 100644 --- a/setuptools/py31compat.py +++ b/setuptools/py31compat.py @@ -14,6 +14,7 @@ except ImportError: raise ValueError("Name must be purelib or platlib") return get_python_lib(name == 'platlib') + try: # Python >=3.2 from tempfile import TemporaryDirectory diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 2babb636..53ce1551 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -99,6 +99,7 @@ class UnpickleableException(Exception): """ An exception representing another Exception that could not be pickled. """ + @staticmethod def dump(type, exc): """ @@ -243,6 +244,7 @@ def run_setup(setup_script, args): def runner(): ns = dict(__file__=setup_script, __name__='__main__') _execfile(setup_script, ns) + DirectorySandbox(setup_dir).run(runner) except SystemExit as v: if v.args and v.args[0]: @@ -301,6 +303,7 @@ class AbstractSandbox: if self._active: path = self._remap_input(name, path, *args, **kw) return original(path, *args, **kw) + return wrap if _file: @@ -322,6 +325,7 @@ class AbstractSandbox: path = self._remap_input(name, path, *args, **kw) return self._remap_output(name, original(path, *args, **kw)) return original(path, *args, **kw) + return wrap for name in ['readlink', 'tempnam']: @@ -336,6 +340,7 @@ class AbstractSandbox: if self._active: return self._remap_output(name, retval) return retval + return wrap for name in ['getcwd', 'tmpnam']: @@ -404,6 +409,7 @@ class DirectorySandbox(AbstractSandbox): raise SandboxViolation(operation, args, kw) if _file: + def _file(self, path, mode='r', *args, **kw): if mode not in ('r', 'rt', 'rb', 'rU', 'U') and not self._ok(path): self._violation("file", path, mode, *args, **kw) diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py index 16272630..82f8870a 100644 --- a/setuptools/ssl_support.py +++ b/setuptools/ssl_support.py @@ -29,7 +29,6 @@ cert_paths = """ /etc/ssl/ca-bundle.pem """.strip().split() - try: HTTPSHandler = urllib.request.HTTPSHandler HTTPSConnection = http_client.HTTPSConnection @@ -50,10 +49,13 @@ except ImportError: match_hostname = None if not CertificateError: + class CertificateError(ValueError): pass + if not match_hostname: + def _dnsname_match(dn, hostname, max_wildcards=1): """Matching according to RFC 6125, section 6.4.3 @@ -216,7 +218,6 @@ def get_win_certfile(): return None class MyCertFile(CertFile): - def __init__(self, stores=(), certs=()): CertFile.__init__(self) for store in stores: diff --git a/setuptools/tests/__init__.py b/setuptools/tests/__init__.py index 53bd836c..dbf16201 100644 --- a/setuptools/tests/__init__.py +++ b/setuptools/tests/__init__.py @@ -42,7 +42,6 @@ needs_bytecode = pytest.mark.skipif( class TestDepends: - def testExtractConst(self): if not hasattr(dep, 'extract_constant'): # skip on non-bytecode platforms @@ -123,7 +122,6 @@ class TestDepends: class TestDistro: - def setup_method(self, method): self.e1 = Extension('bar.ext', ['bar.c']) self.e2 = Extension('c.y', ['y.c']) @@ -214,7 +212,6 @@ class TestDistro: class TestFeatures: - def setup_method(self, method): self.req = Require('Distutils', '1.0.3', 'distutils') self.dist = makeSetup( @@ -292,7 +289,6 @@ class TestFeatures: class TestCommandTests: - def testTestIsCommand(self): test_cmd = makeSetup().get_command_obj('test') assert (isinstance(test_cmd, distutils.cmd.Command)) diff --git a/setuptools/tests/server.py b/setuptools/tests/server.py index 9e5fefb7..35312120 100644 --- a/setuptools/tests/server.py +++ b/setuptools/tests/server.py @@ -45,7 +45,6 @@ class IndexServer(BaseHTTPServer.HTTPServer): class RequestRecorder(BaseHTTPServer.BaseHTTPRequestHandler): - def do_GET(self): requests = vars(self.server).setdefault('requests', []) requests.append(self) diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py index c77aa226..5aabf404 100644 --- a/setuptools/tests/test_bdist_egg.py +++ b/setuptools/tests/test_bdist_egg.py @@ -9,7 +9,6 @@ from setuptools.dist import Distribution from . import contexts - SETUP_PY = """\ from setuptools import setup @@ -28,7 +27,6 @@ def setup_context(tmpdir): class Test: - def test_bdist_egg(self, setup_context, user_override): dist = Distribution(dict( script_name='setup.py', diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index ac002f44..60257154 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -10,7 +10,6 @@ from setuptools.extension import Extension class TestBuildExt: - def test_get_ext_filename(self): """ Setuptools needs to give back the same diff --git a/setuptools/tests/test_develop.py b/setuptools/tests/test_develop.py index f1580785..4cf483f2 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -13,7 +13,6 @@ from setuptools.command.develop import develop from setuptools.dist import Distribution from . import contexts - SETUP_PY = """\ from setuptools import setup diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index 82e1d7e8..209e6b78 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - """Easy install Tests """ from __future__ import absolute_import @@ -42,7 +41,6 @@ from .textwrap import DALS class FakeDist(object): - def get_entry_map(self, group): if group != 'console_scripts': return {} @@ -60,7 +58,6 @@ SETUP_PY = DALS(""" class TestEasyInstallTest: - def test_install_site_py(self, tmpdir): dist = Distribution() cmd = ei.easy_install(dist) @@ -194,7 +191,6 @@ class TestEasyInstallTest: class TestPTHFileWriter: - def test_add_from_cwd_site_sets_dirty(self): '''a pth file manager should set dirty if a distribution is in site but also the cwd @@ -328,13 +324,11 @@ def distutils_package(): class TestDistutilsPackage: - def test_bdist_egg_available_on_distutils_pkg(self, distutils_package): run_setup('setup.py', ['bdist_egg']) class TestSetupRequires: - def test_setup_requires_honors_fetch_params(self): """ When easy_install installs a source distribution which specifies @@ -623,7 +617,6 @@ class TestScriptHeader: class TestCommandSpec: - def test_custom_launch_command(self): """ Show how a custom CommandSpec could be used to specify a #! executable @@ -659,7 +652,6 @@ class TestCommandSpec: class TestWindowsScriptWriter: - def test_header(self): hdr = ei.WindowsScriptWriter.get_script_header('') assert hdr.startswith('#!') diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 4c767826..12c10497 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -262,7 +262,6 @@ class TestEggInfo(object): def _find_egg_info_files(self, root): class DirList(list): - def __init__(self, files, base): super(DirList, self).__init__(files) self.base = base diff --git a/setuptools/tests/test_find_packages.py b/setuptools/tests/test_find_packages.py index 6dc1b3ac..a6023de9 100644 --- a/setuptools/tests/test_find_packages.py +++ b/setuptools/tests/test_find_packages.py @@ -38,7 +38,6 @@ def has_symlink(): class TestFindPackages: - def setup_method(self, method): self.dist_dir = tempfile.mkdtemp() self._make_pkg_structure() diff --git a/setuptools/tests/test_integration.py b/setuptools/tests/test_integration.py index 04772ba5..78fb0627 100644 --- a/setuptools/tests/test_integration.py +++ b/setuptools/tests/test_integration.py @@ -49,6 +49,7 @@ def install_context(request, tmpdir, monkeypatch): user_base.remove() user_site.remove() install_dir.remove() + request.addfinalizer(fin) # Change the environment and site settings to control where the diff --git a/setuptools/tests/test_manifest.py b/setuptools/tests/test_manifest.py index 8bcf4f5c..602c43a2 100644 --- a/setuptools/tests/test_manifest.py +++ b/setuptools/tests/test_manifest.py @@ -30,7 +30,6 @@ SETUP_ATTRS = { 'packages': ['app'], } - SETUP_PY = """\ from setuptools import setup @@ -95,7 +94,6 @@ def test_translated_pattern_test(): class TempDirTestCase(object): - def setup_method(self, method): self.temp_dir = tempfile.mkdtemp() self.old_cwd = os.getcwd() @@ -107,14 +105,12 @@ class TempDirTestCase(object): class TestManifestTest(TempDirTestCase): - def setup_method(self, method): super(TestManifestTest, self).setup_method(method) f = open(os.path.join(self.temp_dir, 'setup.py'), 'w') f.write(SETUP_PY) f.close() - """ Create a file tree like: - LICENSE diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index f9bf895b..f09dd78c 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -14,7 +14,6 @@ from .textwrap import DALS class TestPackageIndex: - def test_regex(self): hash_url = 'http://other_url?:action=show_md5&' hash_url += 'digest=0123456789abcdef0123456789abcdef' @@ -184,7 +183,6 @@ class TestPackageIndex: class TestContentCheckers: - def test_md5(self): checker = setuptools.package_index.HashChecker.from_url( 'http://foo/bar#md5=f12895fdffbd45007040d2e44df98478') @@ -219,7 +217,6 @@ class TestContentCheckers: class TestPyPIConfig: - def test_percent_in_password(self, tmpdir, monkeypatch): monkeypatch.setitem(os.environ, 'HOME', str(tmpdir)) pypirc = tmpdir / '.pypirc' diff --git a/setuptools/tests/test_sandbox.py b/setuptools/tests/test_sandbox.py index aa6138e4..b92a477a 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -11,7 +11,6 @@ from setuptools.sandbox import DirectorySandbox class TestSandbox: - def test_devnull(self, tmpdir): sandbox = DirectorySandbox(str(tmpdir)) sandbox.run(self._file_writer(os.devnull)) @@ -21,6 +20,7 @@ class TestSandbox: def do_write(): with open(path, 'w') as f: f.write('xxx') + return do_write def test_win32com(self, tmpdir): @@ -57,7 +57,6 @@ class TestSandbox: class TestExceptionSaver: - def test_exception_trapped(self): with setuptools.sandbox.ExceptionSaver(): raise ValueError("details") @@ -107,6 +106,7 @@ class TestExceptionSaver: As revealed in #440, an infinite recursion can occur if an unpickleable exception while setuptools is hidden. Ensure this doesn't happen. """ + class ExceptionUnderTest(Exception): """ An unpickleable exception (not in globals). @@ -126,10 +126,12 @@ class TestExceptionSaver: should reflect a proper exception and not be wrapped in an UnpickleableException. """ + def write_file(): "Trigger a SandboxViolation by writing outside the sandbox" with open('/etc/foo', 'w'): pass + sandbox = DirectorySandbox(str(tmpdir)) with pytest.raises(setuptools.sandbox.SandboxViolation) as caught: with setuptools.sandbox.save_modules(): diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index 16d0eb07..609c7830 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -20,10 +20,8 @@ from setuptools.command.egg_info import manifest_maker from setuptools.dist import Distribution from setuptools.tests import fail_on_ascii - py3_only = pytest.mark.xfail(six.PY2, reason="Test runs on Python 3 only") - SETUP_ATTRS = { 'name': 'sdist_test', 'version': '0.0', @@ -31,14 +29,12 @@ SETUP_ATTRS = { 'package_data': {'sdist_test': ['*.txt']} } - SETUP_PY = """\ from setuptools import setup setup(**%r) """ % SETUP_ATTRS - if six.PY3: LATIN1_FILENAME = 'smörbröd.py'.encode('latin-1') else: @@ -90,7 +86,6 @@ def read_all_bytes(filename): class TestSdistTest: - def setup_method(self, method): self.temp_dir = tempfile.mkdtemp() f = open(os.path.join(self.temp_dir, 'setup.py'), 'w') diff --git a/setuptools/tests/test_test.py b/setuptools/tests/test_test.py index 4155a5b1..7ea43c57 100644 --- a/setuptools/tests/test_test.py +++ b/setuptools/tests/test_test.py @@ -70,7 +70,6 @@ def sample_test(tmpdir_cwd): @pytest.mark.usefixtures('user_override') @pytest.mark.usefixtures('sample_test') class TestTestTest: - def test_test(self): params = dict( name='foo', diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index d3dee616..5d50bb0b 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -10,7 +10,6 @@ from setuptools.dist import Distribution from .textwrap import DALS from . import contexts - SETUP_PY = DALS( """ from setuptools import setup @@ -38,7 +37,6 @@ def sample_project(tmpdir_cwd): @pytest.mark.usefixtures('sample_project') @pytest.mark.usefixtures('user_override') class TestUploadDocsTest: - def test_create_zipfile(self): """ Ensure zipfile creation handles common cases, including a folder diff --git a/setuptools/tests/test_windows_wrappers.py b/setuptools/tests/test_windows_wrappers.py index 5b14d07b..d2871c0f 100644 --- a/setuptools/tests/test_windows_wrappers.py +++ b/setuptools/tests/test_windows_wrappers.py @@ -23,12 +23,10 @@ import pytest from setuptools.command.easy_install import nt_quote_arg import pkg_resources - pytestmark = pytest.mark.skipif(sys.platform != 'win32', reason="Windows only") class WrapperTester: - @classmethod def prep_script(cls, template): python_exe = nt_quote_arg(sys.executable) diff --git a/tests/manual_test.py b/tests/manual_test.py index 9987e662..e5aaf179 100644 --- a/tests/manual_test.py +++ b/tests/manual_test.py @@ -25,6 +25,7 @@ def tempdir(func): finally: os.chdir(old_dir) shutil.rmtree(test_dir) + return _tempdir |