Skip to content

Instantly share code, notes, and snippets.

@piotr-dobrogost
Created October 5, 2015 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save piotr-dobrogost/bee727084fd33f8d5f3b to your computer and use it in GitHub Desktop.
Save piotr-dobrogost/bee727084fd33f8d5f3b to your computer and use it in GitHub Desktop.
@fixture(scope='session')
def custom_settings():
return {}
/home/piotr/.virtualenvs/kotti_content_proxy/bin/python /home/piotr/apps/pycharm-4.5.3/helpers/pydev/pydevd.py --multiproc --client 127.0.0.1 --port 45062 --file /home/piotr/apps/pycharm-4.5.3/helpers/pycharm/pytestrunner.py -p pytest_teamcity kotti_content_proxy/tests
Testing started at 4:53 PM ...
Connected to pydev debugger (build 141.2569)
pydev debugger: process 3164 is connecting
============================= test session starts ==============================
platform linux2 -- Python 2.7.10, pytest-2.8.1, py-1.4.30, pluggy-0.3.1
rootdir: /home/piotr/projects/kotti_content_proxy, inifile: setup.cfg
plugins: Kotti-1.2.1.dev0, xdist-1.13.1, pep8-1.0.6, cov-2.1.0, pycharm-0.3.0
collected 17 items
kotti_content_proxy/__init__.py .
kotti_content_proxy/resources.py .
kotti_content_proxy/views.py .
kotti_content_proxy/tests/conftest.py .
kotti_content_proxy/tests/test_models.py ...E
ScopeMismatch: You tried to access the 'function' scoped fixture 'custom_settings' with a 'session' scoped request object, involved factories
.deps/kotti/kotti/tests/__init__.py:256: def root(db_session)
.deps/kotti/kotti/tests/__init__.py:165: def db_session(config, content, connection, request)
.deps/kotti/kotti/tests/__init__.py:98: def config(request, settings)
.deps/kotti/kotti/tests/__init__.py:92: def settings(unresolved_settings)
.deps/kotti/kotti/tests/__init__.py:79: def unresolved_settings(custom_settings)
../../.virtualenvs/kotti_content_proxy/lib/python2.7/site-packages/_pytest/python.py:532: def get_direct_param_fixture_func(request)
Process finished with exit code 137
test_proxying_custom_attributes_access_during_flush_settings = {
'kotti.base_includes': ' '.join((
'kotti',
'kotti.events',
'kotti.sanitizers')),
'kotti.sanitizers': ' '.join((
'no_html:kotti.sanitizers.no_html',
)),
'kotti.sanitize_on_write': ' '.join((
'kotti.resources.Content.title:no_html',
)),
}
@pytest.mark.parametrize(('custom_settings',), [
(test_proxying_custom_attributes_access_during_flush_settings,)])
def test_proxying_custom_attributes_access_during_flush(root, db_session, app):
import kotti_content_proxy
settings = {
'kotti_content_proxy.proxied_attributes':
'some_attribute another_attribute'
}
kotti_content_proxy.kotti_configure(settings)
from kotti.resources import Document
from kotti_content_proxy.resources import ContentProxy
n = root[u'n'] = Document(title=u'Node<>')
db_session.flush()
n1_proxy = root[u'n_proxy'] = ContentProxy(proxied_id=n.id,
title=u'Proxy for n')
n2_proxy = root[u'n2_proxy'] = ContentProxy(proxied_id=n.id,
title=u'Proxy for n')
db_session.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment