Skip to content

Commit

Permalink
get tests to chooch again
Browse files Browse the repository at this point in the history
  • Loading branch information
janwijbrand committed Jan 10, 2018
1 parent 187a53b commit f3986db
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 36 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
*.pyc
__pycache__
src/*.egg-info

.coverage
.installed.cfg
.tox
*.pyc
bin
develop-eggs
parts
src/*.egg-info
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
language: python
python:
- 2.6
- 2.7
- 3.4
- 3.5
- 3.6
- pypy
- pypy3
install:
- python bootstrap.py
- bin/buildout
- pip install -U pip setuptools
- pip install -U zope.testrunner coverage coveralls
- pip install -U -e .[test]
script:
- bin/test -v1
- coverage run -m zope.testrunner --test-path=src
after_success:
- coveralls
notifications:
email: false
cache: pip
7 changes: 5 additions & 2 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[buildout]
extends =
https://raw.githubusercontent.com/zopefoundation/groktoolkit/resurrection-python3/grok.cfg
develop = .
parts = interpreter test
extends = https://raw.github.com/zopefoundation/groktoolkit/master/grok.cfg
parts =
interpreter
test
versions = versions

[versions]
Expand Down
51 changes: 33 additions & 18 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from setuptools import setup, find_packages
import os
from setuptools import setup, find_packages


def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()


long_description = (
read('README.txt')
+ '\n' +
Expand All @@ -12,15 +14,17 @@ def read(*rnames):
read('CHANGES.txt')
)


tests_require = [
'zope.app.appsetup',
'zope.component',
'zope.interface',
'zope.testing',
'zope.security',
'zope.securitypolicy',
'zope.testing',
]


debug_requires = [
'IPython',
]
Expand All @@ -36,26 +40,37 @@ def read(*rnames):
long_description=long_description,
license='ZPL',
keywords='zope zope3 grok grokproject WSGI Paste paster',
classifiers=['Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Framework :: Zope3',
],

classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: Zope Public License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Framework :: Zope3',
],
packages=find_packages('src'),
package_dir = {'': 'src'},
package_dir={'': 'src'},
namespace_packages=['grokcore'],
include_package_data=True,
zip_safe=False,
install_requires=['setuptools',
'zope.component',
'zope.publisher',
'zope.dottedname',
'zope.app.wsgi',
'zope.app.debug',
],
tests_require = tests_require,
extras_require = dict(test=tests_require, debug=debug_requires),
install_requires=[
'setuptools',
'zope.app.debug',
'zope.app.wsgi',
'zope.component',
'zope.dottedname',
'zope.publisher',
],
tests_require=tests_require,
extras_require=dict(test=tests_require, debug=debug_requires),
entry_points={
'paste.app_factory': [
'main = grokcore.startup:application_factory',
Expand Down
17 changes: 9 additions & 8 deletions src/grokcore/startup/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ API Documentation
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> sitezcml = os.path.join(temp_dir, 'site.zcml')
>>> open(sitezcml, 'w').write('<configure />')
>>> _ = open(sitezcml, 'w').write('<configure />')

Furthermore we create a Zope configuration file, which is also quite
plain::

>>> zope_conf = os.path.join(temp_dir, 'zope.conf')
>>> open(zope_conf, 'wb').write('''
>>> _ = open(zope_conf, 'w').write('''
... site-definition %s
...
... <zodb>
Expand Down Expand Up @@ -224,10 +224,11 @@ API Documentation
>>> app_factory
<zope.app.wsgi.WSGIPublisherApplication object at 0x...>

>>> from zope.interface import implements
>>> from zope.interface import implementer
>>> from zope.security.interfaces import IUnauthorized
>>> class UnauthorizedException(object):
... implements(IUnauthorized)
>>> @implementer(IUnauthorized)
... class UnauthorizedException(object):
... pass
>>>
>>> from zope.component import queryAdapter
>>> from zope.publisher.interfaces import IReRaiseException
Expand Down Expand Up @@ -294,7 +295,7 @@ API Documentation
>>> temp_dir = tempfile.mkdtemp()

>>> sitezcml = os.path.join(temp_dir, 'site.zcml')
>>> open(sitezcml, 'w').write(
>>> _ = open(sitezcml, 'w').write(
... """<configure xmlns="http://namespaces.zope.org/zope">
... <include package="zope.component" file="meta.zcml"/>
... <include package="zope.component"/>
Expand All @@ -307,7 +308,7 @@ API Documentation
... </configure>""")
>>>
>>> zopeconf = os.path.join(temp_dir, 'zope.conf')
>>> open(zopeconf, 'w').write("""
>>> _ = open(zopeconf, 'w').write("""
... site-definition %s
... <zodb>
... <filestorage>
Expand All @@ -326,7 +327,7 @@ API Documentation
>>> old_argv = sys.argv[:]
>>>
>>> script = os.path.join(temp_dir, 'script.py')
>>> open(script, 'w').write(
>>> _ = open(script, 'w').write(
... """import sys
... from pprint import pprint
... pprint(debugger)
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/startup/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def interactive_debug_prompt(zope_conf):
del sys.argv[0]
globals_['__name__'] = '__main__'
globals_['__file__'] = sys.argv[0]
execfile(sys.argv[0], globals_)
exec(open(sys.argv[0]).read(), globals_)
# Housekeeping.
db.close()
sys.exit()
Expand Down
16 changes: 16 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tox]
envlist =
py27,
py34,
py35,
py36,
pypy,
pypy3

[testenv]
commands =
coverage run -m zope.testrunner --test-path=src {posargs:-vc}
deps =
.[test]
zope.testrunner
coverage

0 comments on commit f3986db

Please sign in to comment.