diff options
author | stepshal <nessento@openmailbox.org> | 2016-07-12 22:00:43 +0700 |
---|---|---|
committer | stepshal <nessento@openmailbox.org> | 2016-07-13 06:00:42 +0700 |
commit | 6d11e88f938f09ef16db4c6064b6e74acba4db1d (patch) | |
tree | 18b8d914a2c4fc9f9e00d75a5b30330bb0d1942a | |
parent | e3e21fd3d608d72ebe1ba2e4d2b3a59fbca76554 (diff) | |
download | external_python_setuptools-6d11e88f938f09ef16db4c6064b6e74acba4db1d.tar.gz external_python_setuptools-6d11e88f938f09ef16db4c6064b6e74acba4db1d.tar.bz2 external_python_setuptools-6d11e88f938f09ef16db4c6064b6e74acba4db1d.zip |
Fix quantity of blank lines after code object.
37 files changed, 102 insertions, 32 deletions
diff --git a/bootstrap.py b/bootstrap.py index 70f96258..bf7fb431 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -27,6 +27,7 @@ minimal_egg_info = textwrap.dedent(""" requires.txt = setuptools.command.egg_info:write_requirements """) + def ensure_egg_info(): if os.path.exists('setuptools.egg-info'): return diff --git a/pavement.py b/pavement.py index 303e9bac..f620c790 100644 --- a/pavement.py +++ b/pavement.py @@ -3,10 +3,12 @@ import re from paver.easy import task, path as Path import pip + def remove_all(paths): for path in paths: path.rmtree() if path.isdir() else path.remove() + @task def update_vendored(): vendor = Path('pkg_resources/_vendor') @@ -26,6 +26,7 @@ import setuptools scripts = [] + def _gen_console_scripts(): yield "easy_install = setuptools.command.easy_install:main" diff --git a/setuptools/__init__.py b/setuptools/__init__.py index 67b57e4f..2523ccc7 100644 --- a/setuptools/__init__.py +++ b/setuptools/__init__.py @@ -32,6 +32,7 @@ lib2to3_fixer_packages = ['lib2to3.fixes'] class PackageFinder(object): + @classmethod def find(cls, where='.', exclude=(), include=('*',)): """Return a list all Python packages found within directory 'where' @@ -108,7 +109,9 @@ class PackageFinder(object): """ return lambda name: any(fnmatchcase(name, pat=pat) for pat in patterns) + class PEP420PackageFinder(PackageFinder): + @staticmethod def _looks_like_package(path): return True @@ -119,6 +122,7 @@ setup = distutils.core.setup _Command = _get_unpatched(_Command) + class Command(_Command): __doc__ = _Command.__doc__ diff --git a/setuptools/archive_util.py b/setuptools/archive_util.py index b3c9fa56..4da24ec2 100755 --- a/setuptools/archive_util.py +++ b/setuptools/archive_util.py @@ -15,9 +15,11 @@ import contextlib from pkg_resources import ensure_directory, ContextualZipFile from distutils.errors import DistutilsError + class UnrecognizedFormat(DistutilsError): """Couldn't recognize the archive type""" + def default_filter(src,dst): """The default progress/filter callback; returns True for all files""" return dst diff --git a/setuptools/command/bdist_wininst.py b/setuptools/command/bdist_wininst.py index 073de97b..8243c917 100755 --- a/setuptools/command/bdist_wininst.py +++ b/setuptools/command/bdist_wininst.py @@ -2,6 +2,7 @@ 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 1caf8c81..e6db0764 100644 --- a/setuptools/command/build_ext.py +++ b/setuptools/command/build_ext.py @@ -59,7 +59,9 @@ elif os.name != 'nt': if_dl = lambda s: s if have_rtld else '' + 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/build_py.py b/setuptools/command/build_py.py index 0bad8295..b5de9bda 100644 --- a/setuptools/command/build_py.py +++ b/setuptools/command/build_py.py @@ -15,6 +15,7 @@ try: from setuptools.lib2to3_ex import Mixin2to3 except ImportError: class Mixin2to3: + def run_2to3(self, files, doctests=True): "do nothing" diff --git a/setuptools/command/develop.py b/setuptools/command/develop.py index 11b5df10..3eb86120 100755 --- a/setuptools/command/develop.py +++ b/setuptools/command/develop.py @@ -186,6 +186,7 @@ class VersionlessRequirement(object): >>> str(adapted_dist.as_requirement()) 'foo' """ + def __init__(self, dist): self.__dist = dist diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 9ca1554e..73bdb0cb 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -2158,6 +2158,7 @@ class WindowsScriptWriter(ScriptWriter): class WindowsExecutableLauncherWriter(WindowsScriptWriter): + @classmethod def _get_script_args(cls, type_, name, header, script_text): """ diff --git a/setuptools/command/install_lib.py b/setuptools/command/install_lib.py index 78fe6891..2b31c3e3 100644 --- a/setuptools/command/install_lib.py +++ b/setuptools/command/install_lib.py @@ -3,6 +3,7 @@ import imp from itertools import product, starmap import distutils.command.install_lib as orig + class install_lib(orig.install_lib): """Don't add compiled flags to filenames of non-Python files""" diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py index f200b946..041ee42e 100755 --- a/setuptools/command/sdist.py +++ b/setuptools/command/sdist.py @@ -15,6 +15,7 @@ READMES = 'README', 'README.rst', 'README.txt' _default_revctrl = list + def walk_revctrl(dirname=''): """Find all files under revision control""" for ep in pkg_resources.iter_entry_points('setuptools.file_finders'): diff --git a/setuptools/command/test.py b/setuptools/command/test.py index 39746a02..2d1adba8 100644 --- a/setuptools/command/test.py +++ b/setuptools/command/test.py @@ -14,6 +14,7 @@ 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 @@ -46,6 +47,7 @@ class ScanningLoader(TestLoader): # adapted from jaraco.classes.properties:NonDataProperty class NonDataProperty(object): + def __init__(self, fget): self.fget = fget diff --git a/setuptools/depends.py b/setuptools/depends.py index 9f7c9a35..ef3dbb91 100644 --- a/setuptools/depends.py +++ b/setuptools/depends.py @@ -10,6 +10,7 @@ __all__ = [ 'Require', 'find_module', 'get_module_constant', 'extract_constant' ] + class Require: """A prerequisite to building or installing a distribution""" @@ -39,7 +40,6 @@ class Require: str(version) != "unknown" and version >= self.requested_version def get_version(self, paths=None, default="unknown"): - """Get version number of installed module, 'None', or 'default' Search 'paths' for module. If not found, return 'None'. If found, @@ -78,7 +78,6 @@ class Require: def _iter_code(code): - """Yield '(op,arg)' pair for each operation in code object 'code'""" from array import array @@ -131,7 +130,6 @@ def find_module(module, paths=None): def get_module_constant(module, symbol, default=-1, paths=None): - """Find 'module' by searching 'paths', and extract 'symbol' Return 'None' if 'module' does not exist on 'paths', or it does not define diff --git a/setuptools/dist.py b/setuptools/dist.py index 086e0a58..ee85cf52 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -38,6 +38,7 @@ def _get_unpatched(cls): _Distribution = _get_unpatched(_Distribution) + def _patch_distribution_metadata_write_pkg_info(): """ Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local @@ -61,6 +62,7 @@ _patch_distribution_metadata_write_pkg_info() sequence = tuple, list + def check_importable(dist, attr, value): try: ep = pkg_resources.EntryPoint.parse('x='+value) @@ -80,6 +82,8 @@ def assert_string_list(dist, attr, value): raise DistutilsSetupError( "%r must be a list of strings (got %r)" % (attr,value) ) + + def check_nsp(dist, attr, value): """Verify that namespace packages are valid""" assert_string_list(dist,attr,value) @@ -97,6 +101,7 @@ def check_nsp(dist, attr, value): " is not: please correct this in setup.py", nsp, parent ) + def check_extras(dist, attr, value): """Verify that extras_require mapping is valid""" try: @@ -113,6 +118,7 @@ def check_extras(dist, attr, value): "requirement specifiers." ) + def assert_bool(dist, attr, value): """Verify that value is True, False, 0, or 1""" if bool(value) != value: @@ -131,6 +137,7 @@ def check_requirements(dist, attr, value): ) raise DistutilsSetupError(tmpl.format(attr=attr, error=error)) + def check_entry_points(dist, attr, value): """Verify that entry_points map is parseable""" try: @@ -138,10 +145,12 @@ def check_entry_points(dist, attr, value): except ValueError as e: raise DistutilsSetupError(e) + def check_test_suite(dist, attr, value): if not isinstance(value, six.string_types): raise DistutilsSetupError("test_suite must be a string") + def check_package_data(dist, attr, value): """Verify that value is a dictionary of package names to glob lists""" if isinstance(value,dict): @@ -157,6 +166,7 @@ def check_package_data(dist, attr, value): "wildcard patterns" ) + def check_packages(dist, attr, value): for pkgname in value: if not re.match(r'\w+(\.\w+)*', pkgname): @@ -815,7 +825,6 @@ class Feature: return self.available and self.standard def include_in(self,dist): - """Ensure feature and its requirements are included in distribution You may override this in a subclass to perform additional operations on @@ -836,7 +845,6 @@ class Feature: dist.include_feature(f) def exclude_from(self,dist): - """Ensure feature is excluded from distribution You may override this in a subclass to perform additional operations on @@ -852,7 +860,6 @@ class Feature: dist.exclude_package(item) def validate(self,dist): - """Verify that feature makes sense in context of distribution This method is called by the distribution just before it parses its diff --git a/setuptools/extension.py b/setuptools/extension.py index b9d68178..d265b7a3 100644 --- a/setuptools/extension.py +++ b/setuptools/extension.py @@ -14,6 +14,7 @@ _Extension = _get_unpatched(distutils.core.Extension) msvc.patch_for_specialized_compiler() + def _have_cython(): """ Return True if Cython can be imported. @@ -48,6 +49,7 @@ class Extension(_Extension): sub = functools.partial(re.sub, '.pyx$', target_ext) self.sources = list(map(sub, self.sources)) + class Library(Extension): """Just like a regular Extension, but built as a library instead""" diff --git a/setuptools/lib2to3_ex.py b/setuptools/lib2to3_ex.py index feef591a..f7296786 100644 --- a/setuptools/lib2to3_ex.py +++ b/setuptools/lib2to3_ex.py @@ -12,7 +12,9 @@ from distutils import log from lib2to3.refactor import RefactoringTool, get_fixers_from_package import setuptools + class DistutilsRefactoringTool(RefactoringTool): + def log_error(self, msg, *args, **kw): log.error(msg, *args) @@ -22,7 +24,9 @@ class DistutilsRefactoringTool(RefactoringTool): def log_debug(self, msg, *args): log.debug(msg, *args) + 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/msvc.py b/setuptools/msvc.py index b543c568..012ab32c 100644 --- a/setuptools/msvc.py +++ b/setuptools/msvc.py @@ -769,6 +769,7 @@ class EnvironmentInfo: """ # Variables and properties in this class use originals CamelCase variables # names from Microsoft source files for more easy comparaison. + def __init__(self, arch, vc_ver=None, vc_min_ver=None): self.pi = PlatformInfo(arch) self.ri = RegistryInfo(self.pi) diff --git a/setuptools/package_index.py b/setuptools/package_index.py index e87504db..e9b304b1 100755 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -85,6 +85,7 @@ def egg_info_for_url(url): if '#' in base: base, fragment = base.split('#',1) return base,fragment + def distros_for_url(url, metadata=None): """Yield egg or source distribution objects that might be found at a URL""" base, fragment = egg_info_for_url(url) @@ -97,6 +98,7 @@ def distros_for_url(url, metadata=None): ): yield dist + def distros_for_location(location, basename, metadata=None): """Yield egg or source distribution objects based on basename""" if basename.endswith('.egg.zip'): @@ -118,6 +120,7 @@ def distros_for_location(location, basename, metadata=None): return interpret_distro_name(location, basename, metadata) return [] # no extension matched + def distros_for_filename(filename, metadata=None): """Yield possible egg or source distribution objects based on a filename""" return distros_for_location( @@ -177,6 +180,7 @@ def unique_everseen(iterable, key=None): seen_add(k) yield element + def unique_values(func): """ Wrap a function returning an iterable such that the resulting iterable @@ -190,6 +194,7 @@ def unique_values(func): REL = re.compile("""<([^>]*\srel\s*=\s*['"]?([^'">]+)[^>]*)>""", re.I) # this line is here to fix emacs' cruddy broken syntax highlighting + @unique_values def find_external_links(url, page): """Find rel="homepage" and rel="download" links in `page`, yielding URLs""" @@ -213,6 +218,7 @@ class ContentChecker(object): """ A null content checker that defines the interface for checking content """ + def feed(self, block): """ Feed a block of data to the hash. @@ -232,6 +238,7 @@ class ContentChecker(object): """ return + class HashChecker(ContentChecker): pattern = re.compile( r'(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)=' @@ -672,6 +679,7 @@ class PackageIndex(Environment): ) dl_blocksize = 8192 + def _download_to(self, url, filename): self.info("Downloading %s", url) # Download the file @@ -883,12 +891,14 @@ class PackageIndex(Environment): # references, a hexadecimal numeric reference, or a named reference). entity_sub = re.compile(r'&(#(\d+|x[\da-fA-F]+)|[\w.:-]+);?').sub + def uchr(c): if not isinstance(c, int): return c if c>255: return six.unichr(c) return chr(c) + def decode_entity(match): what = match.group(1) if what.startswith('#x'): @@ -899,10 +909,12 @@ def decode_entity(match): what = six.moves.html_entities.name2codepoint.get(what, match.group(0)) return uchr(what) + def htmldecode(text): """Decode HTML entities in the given text.""" return entity_sub(decode_entity, text) + def socket_timeout(timeout=15): def _socket_timeout(func): def _socket_timeout(*args, **kwargs): @@ -915,6 +927,7 @@ def socket_timeout(timeout=15): return _socket_timeout return _socket_timeout + def _encode_auth(auth): """ A function compatible with Python 2.3-3.3 that will encode @@ -937,10 +950,12 @@ def _encode_auth(auth): # strip the trailing carriage return return encoded.replace('\n','') + class Credential(object): """ A username/password pair. Use like a namedtuple. """ + def __init__(self, username, password): self.username = username self.password = password @@ -952,6 +967,7 @@ class Credential(object): def __str__(self): return '%(username)s:%(password)s' % vars(self) + class PyPIConfig(configparser.RawConfigParser): def __init__(self): @@ -1042,6 +1058,7 @@ open_with_auth = socket_timeout(_SOCKET_TIMEOUT)(open_with_auth) def fix_sf_url(url): return url # backward compatibility + def local_open(url): """Read a local path, with special support for directories""" scheme, server, path, param, query, frag = urllib.parse.urlparse(url) diff --git a/setuptools/py26compat.py b/setuptools/py26compat.py index 40cbb88e..74ec3980 100644 --- a/setuptools/py26compat.py +++ b/setuptools/py26compat.py @@ -9,6 +9,7 @@ try: except ImportError: from urllib import splittag + def strip_fragment(url): """ In `Python 8280 <http://bugs.python.org/issue8280>`_, Python 2.7 and diff --git a/setuptools/py27compat.py b/setuptools/py27compat.py index 702f7d65..66aecc2a 100644 --- a/setuptools/py27compat.py +++ b/setuptools/py27compat.py @@ -4,6 +4,7 @@ Compatibility Support for Python 2.7 and earlier import sys + def get_all_headers(message, key): """ Given an HTTPMessage, return all headers matching a given key. diff --git a/setuptools/py31compat.py b/setuptools/py31compat.py index 8fe6dd9d..04a314ef 100644 --- a/setuptools/py31compat.py +++ b/setuptools/py31compat.py @@ -8,6 +8,7 @@ try: from sysconfig import get_config_vars, get_path except ImportError: from distutils.sysconfig import get_config_vars, get_python_lib + def get_path(name): if name not in ('platlib', 'purelib'): raise ValueError("Name must be purelib or platlib") @@ -19,12 +20,14 @@ try: except ImportError: import shutil import tempfile + class TemporaryDirectory(object): """ Very simple temporary directory context manager. Will try to delete afterward, but will also ignore OS and similar errors on deletion. """ + def __init__(self): self.name = None # Handle mkdtemp raising an exception self.name = tempfile.mkdtemp() diff --git a/setuptools/sandbox.py b/setuptools/sandbox.py index 23e296b1..83c3afdb 100755 --- a/setuptools/sandbox.py +++ b/setuptools/sandbox.py @@ -29,6 +29,7 @@ __all__ = [ "AbstractSandbox", "DirectorySandbox", "SandboxViolation", "run_setup", ] + def _execfile(filename, globals, locals=None): """ Python 3 implementation of execfile. @@ -117,6 +118,7 @@ class ExceptionSaver: A Context Manager that will save an exception, serialized, and restore it later. """ + def __enter__(self): return self @@ -237,6 +239,7 @@ def run_setup(setup_script, args): # reset to include setup dir, w/clean callback list working_set.__init__() working_set.callbacks.append(lambda dist:dist.activate()) + def runner(): ns = dict(__file__=setup_script, __name__='__main__') _execfile(setup_script, ns) @@ -280,6 +283,7 @@ class AbstractSandbox: def _mk_dual_path_wrapper(name): original = getattr(_os,name) + def wrap(self,src,dst,*args,**kw): if self._active: src,dst = self._remap_pair(name,src,dst,*args,**kw) @@ -291,6 +295,7 @@ class AbstractSandbox: def _mk_single_path_wrapper(name, original=None): original = original or getattr(_os,name) + def wrap(self,path,*args,**kw): if self._active: path = self._remap_input(name,path,*args,**kw) @@ -309,6 +314,7 @@ class AbstractSandbox: def _mk_single_with_return(name): original = getattr(_os,name) + def wrap(self,path,*args,**kw): if self._active: path = self._remap_input(name,path,*args,**kw) @@ -321,6 +327,7 @@ class AbstractSandbox: def _mk_query(name): original = getattr(_os,name) + def wrap(self,*args,**kw): retval = original(*args,**kw) if self._active: @@ -364,6 +371,7 @@ except ImportError: # it appears pywin32 is not installed, so no need to exclude. pass + class DirectorySandbox(AbstractSandbox): """Restrict operations to a single subdirectory - pseudo-chroot""" @@ -453,6 +461,7 @@ WRITE_FLAGS = functools.reduce( "O_WRONLY O_RDWR O_APPEND O_CREAT O_TRUNC O_TEMPORARY".split()] ) + class SandboxViolation(DistutilsError): """A setup script attempted to modify the filesystem outside the sandbox""" @@ -468,29 +477,4 @@ script by hand. Please inform the package's author and the EasyInstall maintainers to find out if a fix or workaround is available.""" % self.args - - - - - - - - - - - - - - - - - - - - - - - - - # diff --git a/setuptools/ssl_support.py b/setuptools/ssl_support.py index 657197cf..ecede509 100644 --- a/setuptools/ssl_support.py +++ b/setuptools/ssl_support.py @@ -161,6 +161,7 @@ class VerifyingHTTPSHandler(HTTPSHandler): class VerifyingHTTPSConn(HTTPSConnection): """Simple verifying connection: no auth, subclasses, timeouts, etc.""" + def __init__(self, host, ca_bundle, **kw): HTTPSConnection.__init__(self, host, **kw) self.ca_bundle = ca_bundle @@ -192,6 +193,7 @@ class VerifyingHTTPSConn(HTTPSConnection): self.sock.close() raise + def opener_for(ca_bundle=None): """Get a urlopen() replacement that uses ca_bundle for verification""" return urllib.request.build_opener( @@ -201,6 +203,7 @@ def opener_for(ca_bundle=None): _wincerts = None + def get_win_certfile(): global _wincerts if _wincerts is not None: @@ -212,6 +215,7 @@ 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 32447356..569b060f 100644 --- a/setuptools/tests/__init__.py +++ b/setuptools/tests/__init__.py @@ -40,6 +40,7 @@ needs_bytecode = pytest.mark.skipif( reason="bytecode support not available", ) + class TestDepends: def testExtractConst(self): @@ -289,6 +290,7 @@ class TestFeatures: with pytest.raises(SystemExit): makeSetup(features={'x':Feature('x', remove='y')}) + class TestCommandTests: def testTestIsCommand(self): diff --git a/setuptools/tests/py26compat.py b/setuptools/tests/py26compat.py index 7211f275..5325dad6 100644 --- a/setuptools/tests/py26compat.py +++ b/setuptools/tests/py26compat.py @@ -2,6 +2,7 @@ import sys import tarfile import contextlib + def _tarfile_open_ex(*args, **kwargs): """ Extend result as a context manager. diff --git a/setuptools/tests/server.py b/setuptools/tests/server.py index 6a687937..9e5fefb7 100644 --- a/setuptools/tests/server.py +++ b/setuptools/tests/server.py @@ -18,6 +18,7 @@ class IndexServer(BaseHTTPServer.HTTPServer): # The index files should be located in setuptools/tests/indexes s.stop() """ + def __init__(self, server_address=('', 0), RequestHandlerClass=SimpleHTTPServer.SimpleHTTPRequestHandler): BaseHTTPServer.HTTPServer.__init__(self, server_address, @@ -42,16 +43,20 @@ class IndexServer(BaseHTTPServer.HTTPServer): port = self.server_port return 'http://127.0.0.1:%s/setuptools/tests/indexes/' % port + class RequestRecorder(BaseHTTPServer.BaseHTTPRequestHandler): + def do_GET(self): requests = vars(self.server).setdefault('requests', []) requests.append(self) self.send_response(200, 'OK') + class MockServer(BaseHTTPServer.HTTPServer, threading.Thread): """ A simple HTTP Server that records the requests made to it. """ + def __init__(self, server_address=('', 0), RequestHandlerClass=RequestRecorder): BaseHTTPServer.HTTPServer.__init__(self, server_address, diff --git a/setuptools/tests/test_bdist_egg.py b/setuptools/tests/test_bdist_egg.py index ccfb2ea7..a7ceac86 100644 --- a/setuptools/tests/test_bdist_egg.py +++ b/setuptools/tests/test_bdist_egg.py @@ -15,6 +15,7 @@ from setuptools import setup setup(name='foo', py_modules=['hi']) """ + @pytest.yield_fixture def setup_context(tmpdir): with (tmpdir/'setup.py').open('w') as f: diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 0719ba44..5168ebf0 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -3,7 +3,9 @@ import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution + 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 1b844499..d22e5e4a 100644 --- a/setuptools/tests/test_develop.py +++ b/setuptools/tests/test_develop.py @@ -26,6 +26,7 @@ setup(name='foo', INIT_PY = """print "foo" """ + @pytest.yield_fixture def temp_user(monkeypatch): with contexts.tempdir() as user_base: @@ -54,6 +55,7 @@ def test_env(tmpdir, temp_user): class TestDevelop: in_virtualenv = hasattr(sys, 'real_prefix') in_venv = hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix + @pytest.mark.skipif(in_virtualenv or in_venv, reason="Cannot run when invoked in a virtualenv or venv") def test_2to3_user_mode(self, test_env): diff --git a/setuptools/tests/test_easy_install.py b/setuptools/tests/test_easy_install.py index fd06b6ef..894c4fd8 100644 --- a/setuptools/tests/test_easy_install.py +++ b/setuptools/tests/test_easy_install.py @@ -41,6 +41,7 @@ from .textwrap import DALS class FakeDist(object): + def get_entry_map(self, group): if group != 'console_scripts': return {} @@ -55,6 +56,7 @@ SETUP_PY = DALS(""" setup(name='foo') """) + class TestEasyInstallTest: def test_install_site_py(self, tmpdir): @@ -133,6 +135,7 @@ 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 @@ -266,6 +269,7 @@ def distutils_package(): class TestDistutilsPackage: + def test_bdist_egg_available_on_distutils_pkg(self, distutils_package): run_setup('setup.py', ['bdist_egg']) @@ -557,6 +561,7 @@ class TestScriptHeader: class TestCommandSpec: + def test_custom_launch_command(self): """ Show how a custom CommandSpec could be used to specify a #! executable @@ -601,6 +606,7 @@ 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 3a0db58f..afbda2cc 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -235,6 +235,7 @@ 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 06a7c02e..65e7243d 100644 --- a/setuptools/tests/test_find_packages.py +++ b/setuptools/tests/test_find_packages.py @@ -13,6 +13,8 @@ from setuptools import find_packages find_420_packages = setuptools.PEP420PackageFinder.find # modeled after CPython's test.support.can_symlink + + def can_symlink(): TESTFN = tempfile.mktemp() symlink_path = TESTFN + "can_symlink" @@ -26,6 +28,7 @@ def can_symlink(): globals().update(can_symlink=lambda: can) return can + def has_symlink(): bad_symlink = ( # Windows symlink directory detection is broken on Python 3.2 @@ -33,6 +36,7 @@ def has_symlink(): ) return can_symlink() and not bad_symlink + class TestFindPackages: def setup_method(self, method): diff --git a/setuptools/tests/test_packageindex.py b/setuptools/tests/test_packageindex.py index 6a76b5fc..61f5909b 100644 --- a/setuptools/tests/test_packageindex.py +++ b/setuptools/tests/test_packageindex.py @@ -209,6 +209,7 @@ 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 fefd46f7..aa6138e4 100644 --- a/setuptools/tests/test_sandbox.py +++ b/setuptools/tests/test_sandbox.py @@ -57,6 +57,7 @@ class TestSandbox: class TestExceptionSaver: + def test_exception_trapped(self): with setuptools.sandbox.ExceptionSaver(): raise ValueError("details") diff --git a/setuptools/tests/test_sdist.py b/setuptools/tests/test_sdist.py index d2a1f1bb..16d0eb07 100644 --- a/setuptools/tests/test_sdist.py +++ b/setuptools/tests/test_sdist.py @@ -132,7 +132,6 @@ class TestSdistTest: assert os.path.join('sdist_test', 'b.txt') in manifest assert os.path.join('sdist_test', 'c.rst') not in manifest - def test_defaults_case_sensitivity(self): """ Make sure default files (README.*, etc.) are added in a case-sensitive diff --git a/tests/manual_test.py b/tests/manual_test.py index 808fa55a..0904b607 100644 --- a/tests/manual_test.py +++ b/tests/manual_test.py @@ -10,9 +10,11 @@ from string import Template from six.moves import urllib + def _system_call(*args): assert subprocess.call(args) == 0 + def tempdir(func): def _tempdir(*args, **kwargs): test_dir = tempfile.mkdtemp() @@ -62,6 +64,7 @@ def test_virtualenv(): res = f.read() assert 'setuptools' in res + @tempdir def test_full(): """virtualenv + pip + buildout""" |