Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Merge fc1a64b into c8f785c
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Howitz committed Dec 15, 2018
2 parents c8f785c + fc1a64b commit 124b666
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 12 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.egg-info/
*.eggs
*.py[co]
.coverage
.coverage.*
.installed.cfg
.tox/
__pycache__/
bin/
build/
coverage.xml
develop-eggs/
dist/
eggs/
htmlcov/
parts/
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: python
python:
- 2.7
install:
- pip install -U pip setuptools
- pip install -U coverage coveralls zope.testrunner
- pip install -U -e .[test]
script:
- coverage run -m zope.testrunner --test-path=src
after_success:
- coveralls
notifications:
email: false
cache: pip
2 changes: 1 addition & 1 deletion CHANGES.txt → CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Changes
0.6 (unreleased)
----------------

- Nothing changed yet.
- Update tests to `zope.testbrowser >= 5`.


0.5 (2013-03-09)
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def read(path):
author_email = "zope-dev@zope.org",
description = "UI for zope.preference using z3c.pagelet and z3c.form.",
long_description='\n\n'.join([
read('README.txt'),
read('README.rst'),
'.. contents::',
read('CHANGES.txt'),
read('src/z3c/preference/README.txt'),
read('src/z3c/preference/categories.txt'),
read('TODO.txt'),
read('CHANGES.rst'),
read('src/z3c/preference/README.rst'),
read('src/z3c/preference/categories.rst'),
read('TODO.rst'),
]),
license = "ZPL 2.1",
keywords = "zope3 bluebream z3c preference ui",
Expand Down Expand Up @@ -61,7 +61,7 @@ def read(path):
'zope.principalregistry',
'zope.app.principalannotation',
'zope.securitypolicy',
'zope.testbrowser',
'zope.testbrowser >= 5',
'zope.testing',
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ The interface must be registered for preferences:
To access the forms a browser is needed, the user must be authorized as
the preferences are stored in the principal annotations:

>>> from zope.app.wsgi.testlayer import Browser
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ The interfaces must be registered for preferences:
To access the forms a browser is needed, the user must be authorized as
the preferences are stored in the principal annotations:

>>> from zope.app.wsgi.testlayer import Browser
>>> from zope.testbrowser.wsgi import Browser
>>> browser = Browser()
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')

Expand Down
19 changes: 18 additions & 1 deletion src/z3c/preference/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,22 @@

import z3c.preference
import zope.app.wsgi.testlayer
import zope.testbrowser.wsgi

Layer = zope.app.wsgi.testlayer.BrowserLayer(z3c.preference)

class BrowserLayer(zope.testbrowser.wsgi.Layer,
zope.app.wsgi.testlayer.BrowserLayer):
"""BrowserLayer which is compatible with zope.testbrowser."""

def testSetUp(self):
super(BrowserLayer, self).testSetUp()
self._application.requestFactory._db = self.db

def testTearDown(self):
self._application.requestFactory._publication_cache.clear()
super(BrowserLayer, self).testTearDown()

make_wsgi_app = zope.app.wsgi.testlayer.BrowserLayer.make_wsgi_app


Layer = BrowserLayer(z3c.preference)
4 changes: 2 additions & 2 deletions src/z3c/preference/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def tearDown(test):

def test_suite():
suite = doctest.DocFileSuite(
'README.txt',
'categories.txt',
'README.rst',
'categories.rst',
setUp=setUp,
tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS)
Expand Down
21 changes: 21 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[tox]
envlist =
py27,
coverage,

[testenv]
usedevelop = true
commands =
zope-testrunner --test-path=src []
extras = test
deps =
zope.testrunner

[testenv:coverage]
basepython = python2.7
commands =
coverage run -m zope.testrunner --test-path=src []
coverage report --fail-under=86
deps =
zope.testrunner
coverage

0 comments on commit 124b666

Please sign in to comment.