Skip to content
This repository has been archived by the owner on Apr 29, 2020. It is now read-only.

Errors encountered while running py.test #77

Open
divyanshutomar opened this issue Apr 30, 2016 · 2 comments
Open

Errors encountered while running py.test #77

divyanshutomar opened this issue Apr 30, 2016 · 2 comments

Comments

@divyanshutomar
Copy link

`======================================== FAILURES ========================================
____________________________ [doctest] _pytest.python.raises _____________________________
1216
1217 .. note::
1218
1219 When usingpytest.raises as a context manager, it's worthwhile to
1220 note that normal context manager rules apply and that the exception
1221 raised must be the final line in the scope of the context manager.
1222 Lines of code after that, within the scope of the context manager will
1223 not be executed. For example::
1224
1225 >>> with raises(OSError) as exc_info:
UNEXPECTED EXCEPTION: SyntaxError('unexpected EOF while parsing', ('<doctest _pytest.python.raises[1]>', 1, 34, 'with raises(OSError) as exc_info:\n'))
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest _pytest.python.raises[1]>", line 1

with raises(OSError) as exc_info:

                                ^

SyntaxError: unexpected EOF while parsing

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/_pytest/python.py:1225: UnexpectedException
_______________________ [doctest] _pytest.recwarn.deprecated_call ________________________
UNEXPECTED EXCEPTION: NameError("name 'myobject' is not defined",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest _pytest.recwarn.deprecated_call[0]>", line 2, in

NameError: name 'myobject' is not defined

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/_pytest/recwarn.py:39: UnexpectedException
_____________ [doctest] pip._vendor.ipaddress._IPAddressBase.reverse_pointer _____________
EXAMPLE LOCATION UNKNOWN, not showing all tests of that example
??? >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
UNEXPECTED EXCEPTION: NameError("name 'ipaddress' is not defined",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.ipaddress._IPAddressBase.reverse_pointer[0]>", line 1, in

NameError: name 'ipaddress' is not defined

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/ipaddress.py:None: UnexpectedException
_____________________________ [doctest] pip._vendor.lockfile _____________________________
003
004 lockfile.py - Platform-independent advisory file locks.
005
006 Requires Python 2.5 unless you apply 2.4.diff
007 Locking is done on a per-thread basis instead of a per-process basis.
008
009 Usage:
010
011 >>> lock = LockFile('somefile')
012 >>> try:
UNEXPECTED EXCEPTION: SyntaxError('invalid syntax', ('<doctest pip._vendor.lockfile[1]>', 4, 20, " print 'somefile', 'is locked already.'\n"))
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.lockfile[1]>", line 4

print 'somefile', 'is locked already.'

               ^

SyntaxError: Missing parentheses in call to 'print'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/lockfile/init.py:12: UnexpectedException
_____________________________ [doctest] pip._vendor.requests _____________________________
UNEXPECTED EXCEPTION: ImportError("No module named 'requests'",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests[0]>", line 1, in

ImportError: No module named 'requests'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/init.py:15: UnexpectedException
__________________ [doctest] pip._vendor.requests.adapters.HTTPAdapter ___________________
070 connections and connection timeouts, never to requests where data has
071 made it to the server. By default, Requests does not retry failed
072 connections. If you need granular control over the conditions under
073 which we retry a request, import urllib3's Retry class and pass
074 that instead.
075 :param pool_block: Whether the connection pool should block for connections.
076
077 Usage::
078
079 >>> import requests
UNEXPECTED EXCEPTION: ImportError("No module named 'requests'",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.adapters.HTTPAdapter[0]>", line 1, in

ImportError: No module named 'requests'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/adapters.py:79: UnexpectedException
_______________________ [doctest] pip._vendor.requests.api.request _______________________
035 :param proxies: (optional) Dictionary mapping protocol to the URL of the proxy.
036 :param verify: (optional) whether the SSL cert will be verified. A CA_BUNDLE path can also be provided. Defaults to True.
037 :param stream: (optional) if False, the response content will be immediately downloaded.
038 :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair.
039 :return: :class:Response <Response> object
040 :rtype: requests.Response
041
042 Usage::
043
044 >>> import requests
UNEXPECTED EXCEPTION: ImportError("No module named 'requests'",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.api.request[0]>", line 1, in

ImportError: No module named 'requests'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/api.py:44: UnexpectedException
_________________ [doctest] pip._vendor.requests.models.PreparedRequest __________________
UNEXPECTED EXCEPTION: ImportError("No module named 'requests'",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.models.PreparedRequest[0]>", line 1, in

ImportError: No module named 'requests'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/models.py:262: UnexpectedException
_____________________ [doctest] pip._vendor.requests.models.Request ______________________
194 :param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.
195 :param json: json for the body to attach to the request (if files or data is not specified).
196 :param params: dictionary of URL parameters to append to the URL.
197 :param auth: Auth handler or (user, pass) tuple.
198 :param cookies: dictionary or CookieJar of cookies to attach to this request.
199 :param hooks: dictionary of callback hooks, for internal usage.
200
201 Usage::
202
203 >>> import requests
UNEXPECTED EXCEPTION: ImportError("No module named 'requests'",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.models.Request[0]>", line 1, in

ImportError: No module named 'requests'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/models.py:203: UnexpectedException
____________________ [doctest] pip._vendor.requests.sessions.Session _____________________
UNEXPECTED EXCEPTION: ImportError("No module named 'requests'",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.sessions.Session[0]>", line 1, in

ImportError: No module named 'requests'

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/sessions.py:273: UnexpectedException
_________________ [doctest] pip._vendor.requests.utils.from_key_val_list _________________
UNEXPECTED EXCEPTION: ValueError('cannot encode objects that are not 2-tuples',)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.utils.from_key_val_list[1]>", line 1, in

File "/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/utils.py", line 168, in from_key_val_list
raise ValueError('cannot encode objects that are not 2-tuples')

ValueError: cannot encode objects that are not 2-tuples

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/utils.py:159: UnexpectedException
__________________ [doctest] pip._vendor.requests.utils.to_key_val_list __________________
174 Take an object and test to see if it can be represented as a
175 dictionary. If it can be, return a list of tuples, e.g.,
176
177 ::
178
179 >>> to_key_val_list([('key', 'val')])
180 [('key', 'val')]
181 >>> to_key_val_list({'key': 'val'})
182 [('key', 'val')]
183 >>> to_key_val_list('string')
UNEXPECTED EXCEPTION: ValueError('cannot encode objects that are not 2-tuples',)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.utils.to_key_val_list[2]>", line 1, in

File "/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/utils.py", line 190, in to_key_val_list
raise ValueError('cannot encode objects that are not 2-tuples')

ValueError: cannot encode objects that are not 2-tuples

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/utils.py:183: UnexpectedException
___ [doctest] pip._vendor.requests.packages.urllib3.connectionpool.connection_from_url ___
803
804 :param **kw:
805 Passes additional parameters to the constructor of the appropriate
806 :class:.ConnectionPool. Useful for specifying things like
807 timeout, maxsize, headers, etc.
808
809 Example::
810
811 >>> conn = connection_from_url('http://google.com/')
812 >>> r = conn.request('GET', '/')
UNEXPECTED EXCEPTION: HostChangedError("HTTPConnectionPool(host='google.com', port=None): Tried to open a foreign host with url: http://www.google.co.in/?gfe_rd=cr&ei=6Y8kV9KZCsyL8Qeawp-oDA",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.packages.urllib3.connectionpool.connection_from_url[1]>", line 1, in

File "/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/request.py", line 69, in request
**urlopen_kw)

File "/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/request.py", line 90, in request_encode_url
return self.urlopen(method, url, **extra_kw)

File "/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 653, in urlopen
release_conn=release_conn, **response_kw)

File "/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 530, in urlopen
raise HostChangedError(self, url, retries)

pip._vendor.requests.packages.urllib3.exceptions.HostChangedError: HTTPConnectionPool(host='google.com', port=None): Tried to open a foreign host with url: http://www.google.co.in/?gfe_rd=cr&ei=6Y8kV9KZCsyL8Qeawp-oDA

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py:812: UnexpectedException
________ [doctest] pip._vendor.requests.packages.urllib3.poolmanager.ProxyManager ________
199 The URL of the proxy to be used.
200
201 :param proxy_headers:
202 A dictionary contaning headers that will be sent to the proxy. In case
203 of HTTP they are being sent with each request, while in the
204 HTTPS/CONNECT case they are sent only once. Could be used for proxy
205 authentication.
206
207 Example:
208 >>> proxy = urllib3.ProxyManager('http://localhost:3128/')
UNEXPECTED EXCEPTION: NameError("name 'urllib3' is not defined",)
Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/doctest.py", line 1318, in __run
compileflags, 1), test.globs)

File "<doctest pip._vendor.requests.packages.urllib3.poolmanager.ProxyManager[0]>", line 1, in

NameError: name 'urllib3' is not defined

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py:208: UnexpectedException
_______ [doctest] pip._vendor.requests.packages.urllib3.util.request.make_headers ________
031 :param proxy_basic_auth:
032 Colon-separated username:password string for 'proxy-authorization: basic ...'
033 auth header.
034
035 :param disable_cache:
036 If True, adds 'cache-control: no-cache' header.
037
038 Example::
039
040 >>> make_headers(keep_alive=True, user_agent="Batman/1.0")
Expected:
{'connection': 'keep-alive', 'user-agent': 'Batman/1.0'}
Got:
{'user-agent': 'Batman/1.0', 'connection': 'keep-alive'}

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/request.py:40: DocTestFailure
___________ [doctest] pip._vendor.requests.packages.urllib3.util.url.parse_url ___________
Expected:
Url(scheme='http', host='google.com', port=None, path='/mail/', ...)
Got:
Url(scheme='http', auth=None, host='google.com', port=None, path='/mail/', query=None, fragment=None)

/Users/divyanshu/Desktop/OSD/pydsa/venv/lib/python3.4/site-packages/pip/_vendor/requests/packages/urllib3/util/url.py:132: DocTestFailure
______________________________________ test_pydist _______________________________________

def test_pydist():
    """Make sure pydist.json exists and validates against our schema."""
    # XXX this test may need manual cleanup of older wheels
  import jsonschema

E ImportError: No module named 'jsonschema'

venv/lib/python3.4/site-packages/wheel/test/test_basic.py:117: ImportError
______________________________________ test_keygen _______________________________________

def test_keygen():
    def get_keyring():
        WheelKeys, keyring = tool.get_keyring()

        class WheelKeysTest(WheelKeys):
            def save(self):
                pass

        class keyringTest:
            backend = keyring.backend
            class backends:
                file = keyring.backends.file
            @classmethod
            def get_keyring(cls):
                class keyringTest2:
                    pw = None
                    def set_password(self, a, b, c):
                        self.pw = c
                    def get_password(self, a, b):
                        return self.pw

                return keyringTest2()

        return WheelKeysTest, keyringTest
  tool.keygen(get_keyring=get_keyring)

venv/lib/python3.4/site-packages/wheel/test/test_tool.py:28:


venv/lib/python3.4/site-packages/wheel/tool/init.py:38: in keygen
WheelKeys, keyring = get_keyring()
venv/lib/python3.4/site-packages/wheel/test/test_tool.py:5: in get_keyring
WheelKeys, keyring = tool.get_keyring()


def get_keyring():
    try:
        from ..signatures import keys
        import keyring
    except ImportError:
      raise WheelError("Install wheel[signatures] (requires keyring, pyxdg) for signatures.")

E wheel.tool.WheelError: Install wheel[signatures](requires keyring, pyxdg) for signatures.

venv/lib/python3.4/site-packages/wheel/tool/init.py:33: WheelError
==================== 18 failed, 93 passed, 33 error in 57.84 seconds =====================
`

@goelakash
Copy link
Collaborator

@divyanshutomar What python version and distro are you testing this on? And can you gives the steps to reproduce this bug?

@webxpl
Copy link

webxpl commented Sep 29, 2016

`env/lib/python3.4/site-packages/wheel/test/test_wheelfile.py ....

----------- coverage: platform linux, python 3.4.3-final-0 -----------
Coverage HTML written to dir htmlcov

========================================================================================================== FAILURES ==========================================================================================================
________________________________________________________________________________________________________ test_pydist _________________________________________________________________________________________________________

def test_pydist():
    """Make sure pydist.json exists and validates against our schema."""
    # XXX this test may need manual cleanup of older wheels
  import jsonschema

E ImportError: No module named 'jsonschema'

env/lib/python3.4/site-packages/wheel/test/test_basic.py:118: ImportError
________________________________________________________________________________________________________ test_keygen _________________________________________________________________________________________________________

def get_keyring():
    try:
        from ..signatures import keys
      import keyring

E ImportError: No module named 'keyring'

env/lib/python3.4/site-packages/wheel/tool/init.py:31: ImportError

During handling of the above exception, another exception occurred:

def test_keygen():
    def get_keyring():
        WheelKeys, keyring = tool.get_keyring()

        class WheelKeysTest(WheelKeys):
            def save(self):
                pass

        class keyringTest:
            @classmethod
            def get_keyring(cls):
                class keyringTest2:
                    pw = None
                    def set_password(self, a, b, c):
                        self.pw = c
                    def get_password(self, a, b):
                        return self.pw

                return keyringTest2()

        return WheelKeysTest, keyringTest
  tool.keygen(get_keyring=get_keyring)

env/lib/python3.4/site-packages/wheel/test/test_tool.py:25:


env/lib/python3.4/site-packages/wheel/tool/init.py:39: in keygen
WheelKeys, keyring = get_keyring()
env/lib/python3.4/site-packages/wheel/test/test_tool.py:5: in get_keyring
WheelKeys, keyring = tool.get_keyring()


def get_keyring():
    try:
        from ..signatures import keys
        import keyring
        assert keyring.get_keyring().priority
    except (ImportError, AssertionError):
      raise WheelError("Install wheel[signatures] (requires keyring, keyrings.alt, pyxdg) for signatures.")

E wheel.tool.WheelError: Install wheel[signatures](requires keyring, keyrings.alt, pyxdg) for signatures.

env/lib/python3.4/site-packages/wheel/tool/init.py:34: WheelError
============================================================================================ 2 failed, 35 passed in 4.66 seconds `

python -V Python 3.4.3+

pip freeze coverage==4.2 Django==1.10.1 django-modeltranslation==0.12 fake-factory==0.5.7 mixer==5.5.7 py==1.4.31 pytest==3.0.3 pytest-cov==2.3.1 pytest-django==3.0.0 python-dateutil==2.5.3 six==1.10.0

@goelakash

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants