Skip to content

Commit

Permalink
fix #8178 conda pip interop assertion error
Browse files Browse the repository at this point in the history
  • Loading branch information
kalefranz committed Jan 30, 2019
1 parent 8eeb1bb commit 9f98b1f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion conda/common/pkg_formats/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def _check_files(self):
for fname in self.MANDATORY_FILES:
if self._metadata_dir_full_path:
fpath = join(self._metadata_dir_full_path, fname)
assert isfile(fpath)
if not isfile(fpath):
raise OSError(ENOENT, strerror(ENOENT), fpath)

def _check_path_data(self, path, checksum, size):
"""Normalizes record data content and format."""
Expand Down
3 changes: 2 additions & 1 deletion conda/core/prefix_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ def _load_site_packages(self):
for af in non_conda_anchor_files:
try:
python_record = read_python_record(self.prefix_path, af, python_pkg_record.version)
except EnvironmentError:
except EnvironmentError as e:
log.info("Python record ignored for anchor path '%s'\n due to %s", af, e)
continue
except ValidationError:
import sys
Expand Down
5 changes: 4 additions & 1 deletion tests/common/pkg_formats/test_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

from datetime import datetime
from errno import ENOENT
import os
from os.path import basename, lexists
from pprint import pprint
Expand Down Expand Up @@ -523,8 +524,10 @@ def test_pydist_check_files():

# Test mandatory file not found
os.remove(fpaths[0])
with pytest.raises(AssertionError):
with pytest.raises(EnvironmentError) as exc:
PythonInstalledDistribution(temp_path, "2.7", None)
assert exc.value.errno == ENOENT
assert temp_path in str(exc.value)


def test_python_dist_info():
Expand Down

0 comments on commit 9f98b1f

Please sign in to comment.