ramses-tech/nefertari

test_wrappers.py fails twice on stable codebase

Closed this issue · 2 comments

@postatum can you look into this?
test_wrappers.py failing on the stable codebase.

pydev debugger: starting (pid: 16760)
Warning: Could not import the test runner: --nose-params. Running with the default pydev unittest runner instead.
Finding files... done.
Importing test modules ... done.

test_add_confirmation_url (test_wrappers.TestWrappers) ... ok
test_add_confirmation_url_no_request_params (test_wrappers.TestWrappers) ... ok
test_add_etag (test_wrappers.TestWrappers) ... ok
test_add_etag_no_data (test_wrappers.TestWrappers) ... ok
test_add_meta (test_wrappers.TestWrappers) ... ok
test_add_meta_type_error (test_wrappers.TestWrappers) ... ok
test_add_object_url_collection (test_wrappers.TestWrappers) ... ok
test_add_object_url_collection_no_type (test_wrappers.TestWrappers) ... ERROR
test_add_object_url_collection_not_found_resource (test_wrappers.TestWrappers) ... ERROR
test_add_object_url_item (test_wrappers.TestWrappers) ... ok
test_apply_request_privacy_invalid (test_wrappers.TestWrappers) ... No handlers could be found for logger "nefertari.json_httpexceptions"
ok
test_apply_request_privacy_valid (test_wrappers.TestWrappers) ... ok
test_callable_base (test_wrappers.TestWrappers) ... ok
test_obj2dict_dict_result (test_wrappers.TestWrappers) ... ok
test_obj2dict_list_from_todict (test_wrappers.TestWrappers) ... ok
test_obj2dict_nested (test_wrappers.TestWrappers) ... ok
test_obj2dict_other_type (test_wrappers.TestWrappers) ... ok
test_obj2dict_regular (test_wrappers.TestWrappers) ... ok
test_set_public_count (test_wrappers.TestWrappers) ... ok
test_set_public_limits (test_wrappers.TestWrappers) ... ok
test_set_public_limits_count (test_wrappers.TestWrappers) ... ok
test_set_public_limits_no_params (test_wrappers.TestWrappers) ... ok
test_set_public_limits_value_err (test_wrappers.TestWrappers) ... ok
test_set_total (test_wrappers.TestWrappers) ... ok
test_set_total_no_meta (test_wrappers.TestWrappers) ... ok
test_wrap_in_dict_meta_dict (test_wrappers.TestWrappers) ... ok
test_wrap_in_dict_meta_list (test_wrappers.TestWrappers) ... ok
test_wrap_in_dict_no_meta_dict (test_wrappers.TestWrappers) ... ok
test_wrap_in_dict_no_meta_list (test_wrappers.TestWrappers) ... ok
test_wrap_me_call (test_wrappers.TestWrappers) ... ok
test_wrap_me_init (test_wrappers.TestWrappers) ... ok

======================================================================
ERROR: test_add_object_url_collection_no_type (test_wrappers.TestWrappers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/project/base/dir/test_wrappers.py", line 122, in test_add_object_url_collection_no_type
    wrapper = wrappers.add_object_url(request=request)
  File "/project/base/dir/lib/python2.7/site-packages/nefertari/wrappers.py", line 298, in __init__
    self.model_collections = self.request.registry._model_collections
AttributeError: 'Registry' object has no attribute '_model_collections'

======================================================================
ERROR: test_add_object_url_collection_not_found_resource (test_wrappers.TestWrappers)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/project/base/dir/test_wrappers.py", line 114, in test_add_object_url_collection_not_found_resource
    wrapper = wrappers.add_object_url(request=request)
  File "/project/base/dir/lib/python2.7/site-packages/nefertari/wrappers.py", line 298, in __init__
    self.model_collections = self.request.registry._model_collections
AttributeError: 'Registry' object has no attribute '_model_collections'

----------------------------------------------------------------------
Ran 31 tests in 4.456s

FAILED (errors=2)

That may be an issue of difference in envs. Master builds successful so is my local repo.

Here is my pip freeze

Babel==1.3
Jinja2==2.7.3
MarkupSafe==0.23
PasteDeploy==1.5.2
Pygments==2.0.2
Sphinx==1.3.1
Tempita==0.5.2
WebOb==1.4
WebTest==2.0.18
alabaster==0.7.3
argparse==1.2.1
beautifulsoup4==4.3.2
blinker==1.3
cov-core==1.15.0
coverage==3.7.1
cryptacular==1.4.1
docutils==0.12
elasticsearch==1.4.0
flake8==2.4.0
ipdb==0.8
ipython==3.0.0
mccabe==0.3
mock==1.0.1
-e git+git@github.com:postatum/nefertari.git@fd45a7d4f5dad2d11f9e4198bdbd79a44c0bc30b#egg=nefertari-main/master
pbkdf2==1.3
pep8==1.5.7
pluggy==0.3.0
py==1.4.26
pyflakes==0.8.1
pyramid==1.5.4
pytest==2.6.4
pytest-cov==1.8.1
pytz==2015.2
releases==0.7.0
repoze.lru==0.6
requests==2.6.0
simplejson==3.6.5
six==1.9.0
snowballstemmer==1.2.0
sphinx-rtd-theme==0.1.7
tox==2.0.1
translationstring==1.3
urllib3==1.10.2
venusian==1.0
virtualenv==13.0.1
waitress==0.8.9
wsgiref==0.1.2
zope.deprecation==4.1.2
zope.dottedname==4.1.0
zope.interface==4.1.2

my pyenv+virtualenv is on the left https://www.diffchecker.com/iq1syu1n

I've copied your build via "pip install -r" under python 2.7.6 isolated inside a pyenv+virtualenv environment and it fails with the same errors https://www.diffchecker.com/x3iv9lk5

============================================================================================================================== test session starts ===============================================================================================================================
platform linux2 -- Python 2.7.6 -- py-1.4.26 -- pytest-2.6.4
plugins: cov
collected 49 items 

test_wrappers.py .......FF........................................

==================================================================================================================================== FAILURES ====================================================================================================================================
______________________________________________________________________________________________________________ TestWrappers.test_add_object_url_collection_no_type _______________________________________________________________________________________________________________

self = <tests.test_wrappers.TestWrappers testMethod=test_add_object_url_collection_no_type>

    def test_add_object_url_collection_no_type(self):
        result = {'data': [{'_pk': 4}]}
        request = DummyRequest(path='http://example.com', environ={})
>       wrapper = wrappers.add_object_url(request=request)

test_wrappers.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nefertari.wrappers.add_object_url object at 0x2d4ead0>, request = <pyramid.testing.DummyRequest object at 0x2d4eb10>

    def __init__(self, request):
        self.request = request
>       self.model_collections = self.request.registry._model_collections
E       AttributeError: 'Registry' object has no attribute '_model_collections'

/home/adam/.pyenv/versions/test-nefertari2/lib/python2.7/site-packages/nefertari/wrappers.py:298: AttributeError
_________________________________________________________________________________________________________ TestWrappers.test_add_object_url_collection_not_found_resource _________________________________________________________________________________________________________

self = <tests.test_wrappers.TestWrappers testMethod=test_add_object_url_collection_not_found_resource>

    def test_add_object_url_collection_not_found_resource(self):
        result = {'data': [{'_pk': 4, '_type': 'User'}]}
        environ = {'QUERY_STRING': '_limit=100'}
        request = DummyRequest(path='http://example.com', environ=environ)
>       wrapper = wrappers.add_object_url(request=request)

test_wrappers.py:114: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nefertari.wrappers.add_object_url object at 0x2fc8c10>, request = <pyramid.testing.DummyRequest object at 0x2fc8bd0>

    def __init__(self, request):
        self.request = request
>       self.model_collections = self.request.registry._model_collections
E       AttributeError: 'Registry' object has no attribute '_model_collections'

/home/adam/.pyenv/versions/test-nefertari2/lib/python2.7/site-packages/nefertari/wrappers.py:298: AttributeError
====================================================================================================================== 2 failed, 47 passed in 0.26 seconds =======================================================================================================================