zonca/pytest-ipynb

Cannot pip install pytest-ipynb ?

Closed this issue · 2 comments

$ pip install pytest-ipynb
Downloading/unpacking pytest-ipynb
Cannot fetch index base URL https://pypi.python.org/simple/
Could not find any downloads that satisfy the requirement pytest-ipynb
Cleaning up...
No distributions at all found for pytest-ipynb

Thank you @zonca ! That link and its references helped me figure out that my Python had an old version of OpenSSL. I upgraded my python, and it is working perfectly!
Plus I got to learn a bit of the magic of IPython plugins [1], see more of how Gihub is so helpful [2].
AnneTheAgile

$ conda update python
Fetching package metadata: ....
Solving package specifications: .
Package plan for installation in environment /Users/me/anaconda/envs/py27:

The following NEW packages will be INSTALLED:
    openssl:  1.0.1h-1

The following packages will be UPDATED:
    python:   2.7.5-3  --> 2.7.8-1
    readline: 6.2-1    --> 6.2-2
    sqlite:   3.7.13-1 --> 3.8.4.1-0
    tk:       8.5.13-1 --> 8.5.15-0

Proceed ([y]/n)? y
Unlinking packages ...
[      COMPLETE      ] |#############################################################| 100%
Linking packages ...
[      COMPLETE      ] |#############################################################| 100%

$ pip install pytest-ipynb
Downloading/unpacking pytest-ipynb
  Downloading pytest-ipynb-0.1.1.tar.gz
  Running setup.py (path:/private/var/folders/4f/b8gwyhg905x94twqw2pbklyw0000gn/T/pip_build_me/pytest-ipynb/setup.py) egg_info for package pytest-ipynb

Requirement already satisfied (use --upgrade to upgrade): pytest in /Users/me/anaconda/envs/py27/lib/python2.7/site-packages (from pytest-ipynb)
Installing collected packages: pytest-ipynb
  Running setup.py install for pytest-ipynb

Successfully installed pytest-ipynb
Cleaning up...

$ conda info -e
# conda environments:
py27                  *  /Users/me/anaconda/envs/py27

$ py.test -v
=================================== test session starts ===================================
platform darwin -- Python 2.7.8 -- pytest-2.4.2 -- /Users/me/anaconda/envs/py27/bin/python
plugins: ipynb
collected 4 items

test_ipynb_pytest.ipynb:1: cell 0: setup PASSED
test_ipynb_pytest.ipynb:1: cell 1: test just that a is a PASSED
test_ipynb_pytest.ipynb:1: cell 2: simple test a is b? FAILED
test_ipynb_pytest.ipynb:1: cell 3: scrape web pages with no assert FAILED

======================================== FAILURES =========================================
_______________________________ cell 2: simple test a is b? _______________________________
Notebook execution failed
Cell 2: simple test a is b?

Input:
""" simple test a is b? """
assert 1==2

Traceback:
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-2-78e0598050f4> in <module>()
      1 """ simple test a is b? """
----> 2 assert 1==2

AssertionError:

_________________________ cell 3: scrape web pages with no assert _________________________
Notebook execution failed
Cell 3: scrape web pages with no assert

Input:
""" scrape web pages with no assert """
# http://stackoverflow.com/questions/20211687/python-3-how-to-scrape-webpages-and-filter-for-hrefs-delete-rubbish-and-sort
import urllib2
from bs4 import BeautifulSoup

html_doc = urllib2.urlopen('http://www.google.com')
soup = BeautifulSoup(html_doc)
for link in soup.find_all('a'):
    url = link.get('href')
    print(url)
    assert(url.find("htt") != -1)

Traceback:
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-2-b30d6f760fd2> in <module>()
      9     url = link.get('href')
     10     print(url)
---> 11     assert(url.find("htt") != -1)

AssertionError:

=========================== 2 failed, 2 passed in 4.43 seconds ============================

Refs;
[1] This pytest-ipynb repo has a setup file that adds the pytest11 entrypoint.
https://github.com/zonca/pytest-ipynb/blob/master/setup.py#L14
Then PyTest can find it through setuptools or Distribute.
http://pytest.org/latest/plugins.html#setuptools-entry-points
[2] This issue has @Ivoz's remark that the version of OpenSSL is likely the culprit. ; ; ; ; ; ; X.SSL digest errors (on OSX and windows) · Issue #829 · pypa/pip
pypa/pip#829
[3] In turn, [2] was refernced here; ; X.SSL error · Issue #5 ·
coddingtonbear/python-myfitnesspal#5

 coddingtonbear commented on Sep 24
So, re: your SSL connection error -- that looks like your version of Python was compiled against an outdated version of OpenSSL.

[4] My SO Post; ; ; ; X.git - pip connection failure: cannot fetch index base URL http://pypi.python.org/simple/ - Stack Overflow
http://stackoverflow.com/questions/21294997/pip-connection-failure-cannot-fetch-index-base-url-http-pypi-python-org-simpl/26829947#26829947