diff --git a/pip/basecommand.py b/pip/basecommand.py index 28e22b673..fae948ad2 100644 --- a/pip/basecommand.py +++ b/pip/basecommand.py @@ -220,8 +220,8 @@ class Command(object): sys.exit(VIRTUALENV_NOT_FOUND) # Check if we're using the latest version of pip available - if (not options.disable_pip_version_check - and not getattr(options, "no_index", False)): + if (not options.disable_pip_version_check and not + getattr(options, "no_index", False)): with self._build_session( options, retries=0, diff --git a/pip/commands/install.py b/pip/commands/install.py index 52062c32c..51e65a81f 100644 --- a/pip/commands/install.py +++ b/pip/commands/install.py @@ -211,8 +211,8 @@ class InstallCommand(Command): # If we have --no-install or --no-download and no --build we use the # legacy static build dir - if (options.build_dir is None - and (options.no_install or options.no_download)): + if (options.build_dir is None and + (options.no_install or options.no_download)): options.build_dir = build_prefix if options.download_dir: @@ -237,8 +237,8 @@ class InstallCommand(Command): options.ignore_installed = True temp_target_dir = tempfile.mkdtemp() options.target_dir = os.path.abspath(options.target_dir) - if (os.path.exists(options.target_dir) - and not os.path.isdir(options.target_dir)): + if (os.path.exists(options.target_dir) and not + os.path.isdir(options.target_dir)): raise CommandError( "Target path exists but is not a directory, will not " "continue." @@ -376,9 +376,9 @@ class InstallCommand(Command): raise finally: # Clean up - if ((not options.no_clean) - and ((not options.no_install) - or options.download_dir)): + if ((not options.no_clean) and + ((not options.no_install) or + options.download_dir)): requirement_set.cleanup_files() if options.target_dir: diff --git a/pip/commands/zip.py b/pip/commands/zip.py index 60ccc7fd4..078c5ffad 100644 --- a/pip/commands/zip.py +++ b/pip/commands/zip.py @@ -152,8 +152,8 @@ class ZipCommand(Command): def unzip_package(self, module_name, filename): zip_filename = os.path.dirname(filename) - if (not os.path.isfile(zip_filename) - and zipfile.is_zipfile(zip_filename)): + if (not os.path.isfile(zip_filename) and + zipfile.is_zipfile(zip_filename)): raise InstallationError( 'Module %s (in %s) isn\'t located in a zip file in %s' % (module_name, filename, zip_filename)) @@ -355,9 +355,9 @@ class ZipCommand(Command): if os.path.dirname(path) not in self.paths(): logger.info('Zipped egg: %s', display_path(path)) continue - if (basename != 'site-packages' - and basename != 'dist-packages' - and not path.replace('\\', '/').endswith('lib/python')): + if (basename != 'site-packages' and + basename != 'dist-packages' and not + path.replace('\\', '/').endswith('lib/python')): continue logger.info('In %s:', display_path(path)) diff --git a/pip/compat/__init__.py b/pip/compat/__init__.py index 83aff90f6..ef8930c7f 100644 --- a/pip/compat/__init__.py +++ b/pip/compat/__init__.py @@ -99,5 +99,5 @@ if sys.version_info >= (2, 7): # windows detection, covers cpython and ironpython -WINDOWS = (sys.platform.startswith("win") - or (sys.platform == 'cli' and os.name == 'nt')) +WINDOWS = (sys.platform.startswith("win") or + (sys.platform == 'cli' and os.name == 'nt')) diff --git a/pip/download.py b/pip/download.py index 71b0b53eb..0feac0827 100644 --- a/pip/download.py +++ b/pip/download.py @@ -376,8 +376,8 @@ def get_file_content(url, comes_from=None, session=None): match = _scheme_re.search(url) if match: scheme = match.group(1).lower() - if (scheme == 'file' and comes_from - and comes_from.startswith('http')): + if (scheme == 'file' and comes_from and + comes_from.startswith('http')): raise InstallationError( 'Requirements file %s references URL %s, which is local' % (comes_from, url)) diff --git a/pip/index.py b/pip/index.py index 80e677c5b..b73a8a80e 100644 --- a/pip/index.py +++ b/pip/index.py @@ -228,8 +228,8 @@ class PackageFinder(object): addr = ipaddress.ip_address( origin[1] if ( - isinstance(origin[1], six.text_type) - or origin[1] is None + isinstance(origin[1], six.text_type) or + origin[1] is None ) else origin[1].decode("utf8") ) @@ -250,9 +250,9 @@ class PackageFinder(object): continue # Check to see if the port patches - if (origin[2] != secure_origin[2] - and secure_origin[2] != "*" - and secure_origin[2] is not None): + if (origin[2] != secure_origin[2] and + secure_origin[2] != "*" and + secure_origin[2] is not None): continue # If we've gotten here, then this origin matches the current @@ -369,10 +369,10 @@ class PackageFinder(object): req.name.lower() ) ) - if (not found_versions - and not page_versions - and not dependency_versions - and not file_versions): + if (not found_versions and not + page_versions and not + dependency_versions and not + file_versions): logger.critical( 'Could not find any downloads that satisfy the requirement %s', req, @@ -417,8 +417,8 @@ class PackageFinder(object): # This is an intentional priority ordering all_versions = ( - file_versions + found_versions + page_versions - + dependency_versions + file_versions + found_versions + page_versions + + dependency_versions ) # Filter out anything which doesn't match our specifier @@ -496,8 +496,8 @@ class PackageFinder(object): 'Installed version (%s) is most up-to-date (past versions: ' '%s)', req.satisfied_by.version, - ', '.join(str(i.version) for i in applicable_versions[1:]) - or "none", + ', '.join(str(i.version) for i in applicable_versions[1:]) or + "none", ) raise BestVersionAlreadyInstalled @@ -510,8 +510,8 @@ class PackageFinder(object): selected_version = applicable_versions[0].location - if (selected_version.verifiable is not None - and not selected_version.verifiable): + if (selected_version.verifiable is not None and not + selected_version.verifiable): logger.warning( "%s is potentially insecure and unverifiable.", req.name, ) @@ -572,8 +572,8 @@ class PackageFinder(object): for link in page.rel_links(): normalized = normalize_name(req.name).lower() - if (normalized not in self.allow_external - and not self.allow_all_external): + if (normalized not in self.allow_external and not + self.allow_all_external): self.need_warn_external = True logger.debug( "Not searching %s for files because external " @@ -582,9 +582,9 @@ class PackageFinder(object): ) continue - if (link.trusted is not None - and not link.trusted - and normalized not in self.allow_unverified): + if (link.trusted is not None and not + link.trusted and + normalized not in self.allow_unverified): logger.debug( "Not searching %s for urls, it is an " "untrusted link and cannot produce safe or " @@ -675,8 +675,8 @@ class PackageFinder(object): link ) return - if (pkg_resources.safe_name(wheel.name).lower() - != pkg_resources.safe_name(search_name).lower()): + if (pkg_resources.safe_name(wheel.name).lower() != + pkg_resources.safe_name(search_name).lower()): logger.debug( 'Skipping link %s; wrong project name (not %s)', link, @@ -699,12 +699,12 @@ class PackageFinder(object): comes_from = getattr(link, "comes_from", None) if ( ( - not platform.startswith('win') - and not platform.startswith('macosx') - and not platform == 'cli' - ) - and comes_from is not None - and urllib_parse.urlparse( + not platform.startswith('win') and not + platform.startswith('macosx') and not + platform == 'cli' + ) and + comes_from is not None and + urllib_parse.urlparse( comes_from.url ).netloc.endswith(PyPI.netloc)): if not wheel.supported(tags=supported_tags_noarch): @@ -726,21 +726,21 @@ class PackageFinder(object): ) return - if (link.internal is not None - and not link.internal - and not normalize_name(search_name).lower() - in self.allow_external - and not self.allow_all_external): + if (link.internal is not None and not + link.internal and not + normalize_name(search_name).lower() + in self.allow_external and not + self.allow_all_external): # We have a link that we are sure is external, so we should skip # it unless we are allowing externals logger.debug("Skipping %s because it is externally hosted.", link) self.need_warn_external = True return - if (link.verifiable is not None - and not link.verifiable - and not (normalize_name(search_name).lower() - in self.allow_unverified)): + if (link.verifiable is not None and not + link.verifiable and not + (normalize_name(search_name).lower() + in self.allow_unverified)): # We have a link that we are sure we cannot verify its integrity, # so we should skip it unless we are allowing unsafe installs # for this requirement. @@ -856,8 +856,8 @@ class HTMLPage(object): # Tack index.html onto file:// URLs that point to directories (scheme, netloc, path, params, query, fragment) = \ urllib_parse.urlparse(url) - if (scheme == 'file' - and os.path.isdir(urllib_request.url2pathname(path))): + if (scheme == 'file' and + os.path.isdir(urllib_request.url2pathname(path))): # add trailing slash if not present so urljoin doesn't trim # final segment if not url.endswith('/'): @@ -978,8 +978,8 @@ class HTMLPage(object): # Only api_versions >= 2 have a distinction between # external and internal links internal = bool( - anchor.get("rel") - and "internal" in anchor.get("rel").split() + anchor.get("rel") and + "internal" in anchor.get("rel").split() ) yield Link(url, self, internal=internal) @@ -1016,9 +1016,9 @@ class HTMLPage(object): if not href_match: continue url = ( - href_match.group(1) - or href_match.group(2) - or href_match.group(3) + href_match.group(1) or + href_match.group(2) or + href_match.group(3) ) if not url: continue diff --git a/pip/operations/freeze.py b/pip/operations/freeze.py index 7bea426f2..d61a84c72 100644 --- a/pip/operations/freeze.py +++ b/pip/operations/freeze.py @@ -54,10 +54,10 @@ def freeze( if requirement: with open(requirement) as req_file: for line in req_file: - if (not line.strip() - or line.strip().startswith('#') - or (skip_match and skip_match.search(line)) - or line.startswith(( + if (not line.strip() or + line.strip().startswith('#') or + (skip_match and skip_match.search(line)) or + line.startswith(( '-r', '--requirement', '-Z', '--always-unzip', '-f', '--find-links', diff --git a/pip/req/req_install.py b/pip/req/req_install.py index 9f8582bb1..ec7524f54 100644 --- a/pip/req/req_install.py +++ b/pip/req/req_install.py @@ -134,8 +134,8 @@ class InstallRequirement(object): if is_url(name): link = Link(name) - elif (os.path.isdir(path) - and (os.path.sep in name or name.startswith('.'))): + elif (os.path.isdir(path) and + (os.path.sep in name or name.startswith('.'))): if not is_installable_dir(path): raise InstallationError( "Directory %r is not installable. File 'setup.py' not " @@ -323,8 +323,8 @@ class InstallRequirement(object): # NOTE: this self.name check only works when installing from a # specifier (not archive path/urls) # TODO: take this out later - if (self.name == 'distribute' - and not os.path.isdir( + if (self.name == 'distribute' and not + os.path.isdir( os.path.join(self.source_dir, 'setuptools'))): rmtree(os.path.join(self.source_dir, 'distribute.egg-info')) @@ -431,8 +431,8 @@ exec(compile( if ( os.path.exists( os.path.join(root, dir, 'bin', 'python') - ) - or os.path.exists( + ) or + os.path.exists( os.path.join( root, dir, 'Scripts', 'Python.exe' ) @@ -457,8 +457,8 @@ exec(compile( # an extracted tarball for testing purposes. if len(filenames) > 1: filenames.sort( - key=lambda x: x.count(os.path.sep) - + (os.path.altsep and x.count(os.path.altsep) or 0) + key=lambda x: x.count(os.path.sep) + + (os.path.altsep and x.count(os.path.altsep) or 0) ) self._egg_info_path = os.path.join(base, filenames[0]) return os.path.join(self._egg_info_path, filename) @@ -878,10 +878,10 @@ exec(compile( "import setuptools, tokenize; __file__=%r; exec(compile(" "getattr(tokenize, 'open', open)(__file__).read().replace" "('\\r\\n', '\\n'), __file__, 'exec'))" % self.setup_py - ] - + list(global_options) - + ['develop', '--no-deps'] - + list(install_options), + ] + + list(global_options) + + ['develop', '--no-deps'] + + list(install_options), cwd=cwd, filter_stdout=self._filter_install, show_stdout=False) @@ -924,9 +924,9 @@ exec(compile( # then this check has already run before. we don't want it to # run again, and return False, since it would block the uninstall # TODO: remove this later - if (self.req.project_name == 'setuptools' - and self.conflicts_with - and self.conflicts_with.project_name == 'distribute'): + if (self.req.project_name == 'setuptools' and + self.conflicts_with and + self.conflicts_with.project_name == 'distribute'): return True else: self.satisfied_by = pkg_resources.get_distribution(self.req) @@ -939,8 +939,8 @@ exec(compile( if self.use_user_site: if dist_in_usersite(existing_dist): self.conflicts_with = existing_dist - elif (running_under_virtualenv() - and dist_in_site_packages(existing_dist)): + elif (running_under_virtualenv() and + dist_in_site_packages(existing_dist)): raise InstallationError( "Will not install to the user site because it will " "lack sys.path precedence to %s in %s" % diff --git a/pip/req/req_set.py b/pip/req/req_set.py index 08804b2bd..1b3dd814b 100644 --- a/pip/req/req_set.py +++ b/pip/req/req_set.py @@ -169,8 +169,8 @@ class RequirementSet(object): if self.upgrade: # don't uninstall conflict if user install and # conflict is not user install - if not (self.use_user_site - and not dist_in_usersite( + if not (self.use_user_site and + not dist_in_usersite( req_to_install.satisfied_by )): req_to_install.conflicts_with = \ @@ -195,8 +195,8 @@ class RequirementSet(object): self.build_dir, ) - if (req_to_install.source_dir is not None - and not os.path.isdir(req_to_install.source_dir)): + if (req_to_install.source_dir is not None and not + os.path.isdir(req_to_install.source_dir)): raise InstallationError( 'Could not install requirement %s because source folder %s' ' does not exist (perhaps --no-download was used without ' @@ -245,8 +245,8 @@ class RequirementSet(object): if not best_installed: # don't uninstall conflict if user install and # conflict is not user install - if not (self.use_user_site - and not dist_in_usersite( + if not (self.use_user_site and not + dist_in_usersite( req_to_install.satisfied_by )): req_to_install.conflicts_with = \ @@ -269,8 +269,8 @@ class RequirementSet(object): if req_to_install.editable: logger.info('Obtaining %s', req_to_install) elif install: - if (req_to_install.url - and req_to_install.url.lower().startswith('file:')): + if (req_to_install.url and + req_to_install.url.lower().startswith('file:')): path = url_to_path(req_to_install.url) logger.info('Processing %s', display_path(path)) else: @@ -341,8 +341,8 @@ class RequirementSet(object): try: if ( - url.filename.endswith(wheel_ext) - and self.wheel_download_dir + url.filename.endswith(wheel_ext) and + self.wheel_download_dir ): # when doing 'pip wheel` download_dir = self.wheel_download_dir @@ -393,8 +393,8 @@ class RequirementSet(object): if self.upgrade or self.ignore_installed: # don't uninstall conflict if user install and # conflict is not user install - if not (self.use_user_site - and not dist_in_usersite( + if not (self.use_user_site and not + dist_in_usersite( req_to_install.satisfied_by)): req_to_install.conflicts_with = \ req_to_install.satisfied_by @@ -471,8 +471,8 @@ class RequirementSet(object): def _pip_has_created_build_dir(self): return ( - self.build_dir == build_prefix - and os.path.exists( + self.build_dir == build_prefix and + os.path.exists( os.path.join(self.build_dir, PIP_DELETE_MARKER_FILENAME) ) ) @@ -493,9 +493,9 @@ class RequirementSet(object): # TODO: take this out later distribute_req = pkg_resources.Requirement.parse("distribute>=0.7") for req in to_install: - if (req.name == 'distribute' - and req.installed_version is not None - and req.installed_version in distribute_req): + if (req.name == 'distribute' and + req.installed_version is not None and + req.installed_version in distribute_req): to_install.remove(req) to_install.append(req) @@ -550,13 +550,13 @@ class RequirementSet(object): ) except: # if install did not succeed, rollback previous uninstall - if (requirement.conflicts_with - and not requirement.install_succeeded): + if (requirement.conflicts_with and not + requirement.install_succeeded): requirement.rollback_uninstall() raise else: - if (requirement.conflicts_with - and requirement.install_succeeded): + if (requirement.conflicts_with and + requirement.install_succeeded): requirement.commit_uninstall() requirement.remove_temporary_source() diff --git a/pip/utils/__init__.py b/pip/utils/__init__.py index 67ce5387f..b4ed9e5b7 100644 --- a/pip/utils/__init__.py +++ b/pip/utils/__init__.py @@ -224,8 +224,8 @@ def is_svn_page(html): """ Returns true if the page appears to be the index page of an svn repository """ - return (re.search(r'[^<]*Revision \d+:', html) - and re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I)) + return (re.search(r'<title>[^<]*Revision \d+:', html) and + re.search(r'Powered by (?:<a[^>]*?>)?Subversion', html, re.I)) def file_contents(filename): @@ -236,8 +236,8 @@ def file_contents(filename): def split_leading_dir(path): path = str(path) path = path.lstrip('/').lstrip('\\') - if '/' in path and (('\\' in path and path.find('/') < path.find('\\')) - or '\\' not in path): + if '/' in path and (('\\' in path and path.find('/') < path.find('\\')) or + '\\' not in path): return path.split('/', 1) elif '\\' in path: return path.split('\\', 1) @@ -421,11 +421,11 @@ def get_installed_distributions(local_only=True, return True return [d for d in pkg_resources.working_set - if local_test(d) - and d.key not in skip - and editable_test(d) - and editables_only_test(d) - and user_test(d) + if local_test(d) and + d.key not in skip and + editable_test(d) and + editables_only_test(d) and + user_test(d) ] @@ -576,8 +576,8 @@ def untar_file(filename, location): os.makedirs(location) if filename.lower().endswith('.gz') or filename.lower().endswith('.tgz'): mode = 'r:gz' - elif (filename.lower().endswith('.bz2') - or filename.lower().endswith('.tbz')): + elif (filename.lower().endswith('.bz2') or + filename.lower().endswith('.tbz')): mode = 'r:bz2' elif filename.lower().endswith('.tar'): mode = 'r' @@ -644,22 +644,22 @@ def untar_file(filename, location): def unpack_file(filename, location, content_type, link): filename = os.path.realpath(filename) - if (content_type == 'application/zip' - or filename.endswith('.zip') - or filename.endswith('.whl') - or zipfile.is_zipfile(filename)): + if (content_type == 'application/zip' or + filename.endswith('.zip') or + filename.endswith('.whl') or + zipfile.is_zipfile(filename)): unzip_file( filename, location, flatten=not filename.endswith('.whl') ) - elif (content_type == 'application/x-gzip' - or tarfile.is_tarfile(filename) - or splitext(filename)[1].lower() in ( + elif (content_type == 'application/x-gzip' or + tarfile.is_tarfile(filename) or + splitext(filename)[1].lower() in ( '.tar', '.tar.gz', '.tar.bz2', '.tgz', '.tbz')): untar_file(filename, location) - elif (content_type and content_type.startswith('text/html') - and is_svn_page(file_contents(filename))): + elif (content_type and content_type.startswith('text/html') and + is_svn_page(file_contents(filename))): # We don't really care about this from pip.vcs.subversion import Subversion Subversion('svn+' + link.url).unpack(location) diff --git a/pip/vcs/subversion.py b/pip/vcs/subversion.py index d45fbb257..e39dc23dc 100644 --- a/pip/vcs/subversion.py +++ b/pip/vcs/subversion.py @@ -168,9 +168,9 @@ class Subversion(VersionControl): with open(os.path.join(location, self.dirname, 'entries')) as f: data = f.read() - if (data.startswith('8') - or data.startswith('9') - or data.startswith('10')): + if (data.startswith('8') or + data.startswith('9') or + data.startswith('10')): data = list(map(str.splitlines, data.split('\n\x0c\n'))) del data[0][0] # get rid of the '8' url = data[0][3] diff --git a/pip/wheel.py b/pip/wheel.py index a2d9e126b..865b64602 100644 --- a/pip/wheel.py +++ b/pip/wheel.py @@ -185,10 +185,10 @@ def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None, if is_base and basedir == '' and destsubdir.endswith('.data'): data_dirs.append(s) continue - elif (is_base - and s.endswith('.dist-info') + elif (is_base and + s.endswith('.dist-info') and # is self.req.project_name case preserving? - and s.lower().startswith( + s.lower().startswith( req.project_name.replace('-', '_').lower())): assert not info_dir, 'Multiple .dist-info directories' info_dir.append(destsubdir) diff --git a/tests/conftest.py b/tests/conftest.py index be87d9230..d4d3db9b1 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,9 +18,9 @@ def pytest_collection_modifyitems(items): ) module_root_dir = module_path.split(os.pathsep)[0] - if (module_root_dir.startswith("functional") - or module_root_dir.startswith("integration") - or module_root_dir.startswith("lib")): + if (module_root_dir.startswith("functional") or + module_root_dir.startswith("integration") or + module_root_dir.startswith("lib")): item.add_marker(pytest.mark.integration) elif module_root_dir.startswith("unit"): item.add_marker(pytest.mark.unit) diff --git a/tests/functional/test_help.py b/tests/functional/test_help.py index 90e4ecdfa..d92edd123 100644 --- a/tests/functional/test_help.py +++ b/tests/functional/test_help.py @@ -84,6 +84,6 @@ def test_help_commands_equally_functional(script): continue assert ( - script.pip('help', name).stdout - == script.pip(name, '--help').stdout + script.pip('help', name).stdout == + script.pip(name, '--help').stdout ) diff --git a/tests/lib/__init__.py b/tests/lib/__init__.py index 1d0653c1f..c835690c8 100644 --- a/tests/lib/__init__.py +++ b/tests/lib/__init__.py @@ -173,8 +173,8 @@ class TestPipResult(object): egg_link_file = self.files_created[egg_link_path] # FIXME: I don't understand why there's a trailing . here - if not (egg_link_file.bytes.endswith('\n.') - and egg_link_file.bytes[:-2].endswith(pkg_dir)): + if not (egg_link_file.bytes.endswith('\n.') and + egg_link_file.bytes[:-2].endswith(pkg_dir)): raise TestFailure(textwrap.dedent(u('''\ Incorrect egg_link file %r Expected ending: %r diff --git a/tests/unit/test_appdirs.py b/tests/unit/test_appdirs.py index c95872a32..cf0aa0afc 100644 --- a/tests/unit/test_appdirs.py +++ b/tests/unit/test_appdirs.py @@ -20,8 +20,8 @@ class TestUserCacheDir: ) monkeypatch.setattr(appdirs, "WINDOWS", True) - assert (appdirs.user_cache_dir("pip").replace("/", "\\") - == "C:\\Users\\test\\AppData\\Local\\pip\\Cache") + assert (appdirs.user_cache_dir("pip").replace("/", "\\") == + "C:\\Users\\test\\AppData\\Local\\pip\\Cache") assert _get_win_folder.calls == [pretend.call("CSIDL_LOCAL_APPDATA")] def test_user_cache_dir_osx(self, monkeypatch): @@ -110,8 +110,8 @@ class TestUserDataDir: ) monkeypatch.setattr(appdirs, "WINDOWS", True) - assert (appdirs.user_data_dir("pip").replace("/", "\\") - == "C:\\Users\\test\\AppData\\Local\\pip") + assert (appdirs.user_data_dir("pip").replace("/", "\\") == + "C:\\Users\\test\\AppData\\Local\\pip") assert _get_win_folder.calls == [pretend.call("CSIDL_LOCAL_APPDATA")] def test_user_data_dir_win_yes_roaming(self, monkeypatch): @@ -127,16 +127,18 @@ class TestUserDataDir: ) monkeypatch.setattr(appdirs, "WINDOWS", True) - assert (appdirs.user_data_dir("pip", roaming=True).replace("/", "\\") - == "C:\\Users\\test\\AppData\\Roaming\\pip") + assert ( + appdirs.user_data_dir("pip", roaming=True).replace("/", "\\") == + "C:\\Users\\test\\AppData\\Roaming\\pip" + ) assert _get_win_folder.calls == [pretend.call("CSIDL_APPDATA")] def test_user_data_dir_osx(self, monkeypatch): monkeypatch.setenv("HOME", "/home/test") monkeypatch.setattr(sys, "platform", "darwin") - assert (appdirs.user_data_dir("pip") - == "/home/test/Library/Application Support/pip") + assert (appdirs.user_data_dir("pip") == + "/home/test/Library/Application Support/pip") def test_user_data_dir_linux(self, monkeypatch): monkeypatch.delenv("XDG_DATA_HOME") @@ -169,8 +171,8 @@ class TestUserConfigDir: monkeypatch.setattr(appdirs, "WINDOWS", True) assert ( - appdirs.user_config_dir("pip", roaming=False).replace("/", "\\") - == "C:\\Users\\test\\AppData\\Local\\pip" + appdirs.user_config_dir("pip", roaming=False).replace("/", "\\") == + "C:\\Users\\test\\AppData\\Local\\pip" ) assert _get_win_folder.calls == [pretend.call("CSIDL_LOCAL_APPDATA")] @@ -187,16 +189,16 @@ class TestUserConfigDir: ) monkeypatch.setattr(appdirs, "WINDOWS", True) - assert (appdirs.user_config_dir("pip").replace("/", "\\") - == "C:\\Users\\test\\AppData\\Roaming\\pip") + assert (appdirs.user_config_dir("pip").replace("/", "\\") == + "C:\\Users\\test\\AppData\\Roaming\\pip") assert _get_win_folder.calls == [pretend.call("CSIDL_APPDATA")] def test_user_config_dir_osx(self, monkeypatch): monkeypatch.setenv("HOME", "/home/test") monkeypatch.setattr(sys, "platform", "darwin") - assert (appdirs.user_config_dir("pip") - == "/home/test/Library/Application Support/pip") + assert (appdirs.user_config_dir("pip") == + "/home/test/Library/Application Support/pip") def test_user_config_dir_linux(self, monkeypatch): monkeypatch.delenv("XDG_CONFIG_HOME") @@ -228,16 +230,16 @@ class TestUserLogDir: ) monkeypatch.setattr(appdirs, "WINDOWS", True) - assert (appdirs.user_log_dir("pip").replace("/", "\\") - == "C:\\Users\\test\\AppData\\Local\\pip\\Logs") + assert (appdirs.user_log_dir("pip").replace("/", "\\") == + "C:\\Users\\test\\AppData\\Local\\pip\\Logs") assert _get_win_folder.calls == [pretend.call("CSIDL_LOCAL_APPDATA")] def test_user_log_dir_osx(self, monkeypatch): monkeypatch.setenv("HOME", "/home/test") monkeypatch.setattr(sys, "platform", "darwin") - assert (appdirs.user_log_dir("pip") - == "/home/test/Library/Logs/pip") + assert (appdirs.user_log_dir("pip") == + "/home/test/Library/Logs/pip") def test_uuser_log_dir_linux(self, monkeypatch): monkeypatch.delenv("XDG_CACHE_HOME") diff --git a/tests/unit/test_download.py b/tests/unit/test_download.py index 1cdfcee51..00ba356b3 100644 --- a/tests/unit/test_download.py +++ b/tests/unit/test_download.py @@ -239,8 +239,7 @@ class Test_unpack_file_url(object): # confirm hash is for simple1-1.0 # the previous bad download has been removed - assert (hashlib.md5(open(dest_file, 'rb').read()).hexdigest() - == + assert (hashlib.md5(open(dest_file, 'rb').read()).hexdigest() == dist_path_md5 ), hashlib.md5(open(dest_file, 'rb').read()).hexdigest() @@ -306,8 +305,8 @@ class TestPipSession: assert hasattr(session.adapters["https://"], "cache") - assert (session.adapters["https://"].cache.directory - == tmpdir.join("test-cache")) + assert (session.adapters["https://"].cache.directory == + tmpdir.join("test-cache")) def test_http_cache_is_not_enabled(self, tmpdir): session = PipSession(cache=tmpdir.join("test-cache"))