Skip to content

Commit

Permalink
Merge pull request #6 from zopefoundation/resurrection-python3
Browse files Browse the repository at this point in the history
Resurrection python3.
  • Loading branch information
janwijbrand committed Jan 5, 2018
2 parents 7146011 + f4e27e5 commit 262314f
Show file tree
Hide file tree
Showing 25 changed files with 123 additions and 69 deletions.
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
syntax:glob

.coverage
.installed.cfg
.mr.developer.cfg
.tox
*.bak
*.pyc
*.pyo
*.swp
bin
develop/*
dev
develop-eggs
develop/*
eggs
.installed.cfg
.mr.developer.cfg
parts
src/*.egg-info
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
language: python
python:
- 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
3 changes: 1 addition & 2 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ CHANGES
2.4 (unreleased)
================

- Nothing changed yet.

- Python 3 compatibility.

2.3 (2017-08-11)
================
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
global-include *.mo
include *.txt
include *.rst
include bootstrap.py
Expand Down
6 changes: 3 additions & 3 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ parts =
interpreter
omelette
test
extends = https://raw.github.com/zopefoundation/groktoolkit/master/grok.cfg
versions = versions
extends = https://raw.githubusercontent.com/zopefoundation/groktoolkit/resurrection-python3/grok.cfg
extensions =
mr.developer
auto-checkout =

[versions]
grokcore.catalog =
grokcore.site = 1.7

[sources]

setuptools = 34.4.1
zc.buildout = 2.9.4
Expand Down
11 changes: 11 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def read(*rnames):
long_description = (
read('README.txt') + '\n' + read('CHANGES.txt'))


tests_require = [
'grokcore.content',
'zope.app.appsetup',
Expand All @@ -21,6 +22,7 @@ def read(*rnames):
'zope.app.wsgi',
]


setup(
name='grokcore.catalog',
version='2.4.dev0',
Expand All @@ -36,6 +38,15 @@ def read(*rnames):
'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'),
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/catalog/ftests/catalog/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
>>> from zope.component import getUtility
>>> catalog = getUtility(ICatalog)
>>> for obj in catalog.searchResults(name=('Ellie', 'Ellie')):
... print obj.name
... print(obj.name)
Ellie
Nuke the catalog and intids in the end, so as not to confuse
Expand Down Expand Up @@ -51,8 +51,8 @@ class IMammoth(interface.Interface):
name = interface.Attribute('name')


@interface.implementer(IMammoth)
class Mammoth(Model):
interface.implements(IMammoth)

def __init__(self, name):
self.name = name
Expand Down
6 changes: 3 additions & 3 deletions src/grokcore/catalog/ftests/catalog/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
>>> from zope.component import getUtility, queryUtility
>>> catalog = getUtility(ICatalog)
>>> for obj in catalog.searchResults(name=('Beta', 'Beta')):
... print obj.name
... print(obj.name)
Beta
Let's query the text index, which incidentally also indexes a method::
Expand Down Expand Up @@ -65,7 +65,7 @@
import grokcore.catalog
import grokcore.site
from grokcore.content import Container, Model
from zope.interface import Interface, Attribute, implements
from zope.interface import Interface, Attribute, implementer


class Herd(Container, grokcore.site.Application):
Expand Down Expand Up @@ -94,8 +94,8 @@ class MammothIndexes(grokcore.catalog.Indexes):
message = grokcore.catalog.Text()


@implementer(IMammoth)
class Mammoth(Model):
implements(IMammoth)

def __init__(self, name, age, message):
self.age = age
Expand Down
8 changes: 5 additions & 3 deletions src/grokcore/catalog/ftests/catalog/indexes_app_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,21 @@
import grokcore.site
import grokcore.catalog
from grokcore.content import Container
from zope.interface import Attribute, Interface, implements
from zope.interface import Attribute, Interface, implementer


class IHerd(Interface):
pass


@implementer(IHerd)
class Herd(Container, grokcore.site.Application):
implements(IHerd)
pass


@implementer(IHerd)
class Herd2(Container, grokcore.site.Application):
implements(IHerd)
pass


class IMammoth(Interface):
Expand Down
6 changes: 3 additions & 3 deletions src/grokcore/catalog/ftests/catalog/indexes_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
>>> catalog = getUtility(ICatalog)
>>> for obj in catalog.searchResults(how_old=(13, 13)):
... print obj.name
... print(obj.name)
Alpha
Nuke the catalog and intids in the end, so as not to confuse
Expand All @@ -43,7 +43,7 @@
import grokcore.site
import grokcore.catalog
from grokcore.content import Container, Model
from zope.interface import implements, Attribute, Interface
from zope.interface import implementer, Attribute, Interface


class Herd(Container, grokcore.site.Application):
Expand All @@ -63,8 +63,8 @@ class MammothIndexes(grokcore.catalog.Indexes):
how_old = grokcore.catalog.Field(attribute='age')


@implementer(IMammoth)
class Mammoth(Model):
implements(IMammoth)

def __init__(self, name, age):
self.name = name
Expand Down
2 changes: 1 addition & 1 deletion src/grokcore/catalog/ftests/catalog/indexes_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
>>> from zope.component import getUtility
>>> catalog = getUtility(ICatalog)
>>> for obj in catalog.searchResults(name=('Beta', 'Beta')):
... print obj.name
... print(obj.name)
Beta
Let's query the text index, which incidentally also indexes a method::
Expand Down
10 changes: 5 additions & 5 deletions src/grokcore/catalog/ftests/catalog/indexes_datetimeindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
Note how the index uses a seconds-resolution and sub-second data is ignored::
>>> herd['omega'] = Opossum(
... 'Omega', datetime.datetime(2002, 5, 3, 14, 53, 14, 000001))
... 'Omega', datetime.datetime(2002, 5, 3, 14, 53, 14, 1))
>>> herd['psi'] = Opossum(
... 'Psi', datetime.datetime(2002, 5, 3, 14, 53, 14, 999999))
>>> sortedResults(catalog, birthday={
... 'between': [datetime.datetime(2002, 5, 3l, 14, 53, 14),
... datetime.datetime(2002, 5, 3l, 14, 53, 14)]})
... 'between': [datetime.datetime(2002, 5, 3, 14, 53, 14),
... datetime.datetime(2002, 5, 3, 14, 53, 14)]})
['Omega', 'Psi']
Nuke the catalog and intids in the end, so as not to confuse
Expand All @@ -71,7 +71,7 @@
import grokcore.site
import grokcore.catalog
from grokcore.content import Container, Model
from zope.interface import implements, Interface, Attribute
from zope.interface import implementer, Interface, Attribute


class Herd(Container, grokcore.site.Application):
Expand All @@ -90,8 +90,8 @@ class OpossumIndexes(grokcore.catalog.Indexes):
birthday = grokcore.catalog.Datetime()


@implementer(IOpossum)
class Opossum(Model):
implements(IOpossum)

def __init__(self, name, birthday):
self.name = name
Expand Down
5 changes: 3 additions & 2 deletions src/grokcore/catalog/ftests/catalog/indexes_install_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import grokcore.site
import grokcore.catalog
from grokcore.content import Container
from zope.interface import Interface, Attribute, implements
from zope.interface import Interface, Attribute, implementer
from zope.component.interfaces import ObjectEvent, IObjectEvent


Expand All @@ -59,8 +59,9 @@ class IMudPartyEvent(IObjectEvent):
pass


@implementer(IMudPartyEvent)
class MudPartyEvent(ObjectEvent):
implements(IMudPartyEvent)
pass


class IMammoth(Interface):
Expand Down
5 changes: 3 additions & 2 deletions src/grokcore/catalog/ftests/catalog/indexes_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
>>> from zope.catalog.interfaces import ICatalog
>>> from zope.component import getUtility, queryUtility
>>> catalog = getUtility(ICatalog)
>>> sorted(catalog.keys())
[u'age', u'age2', u'message', u'message2', u'name', u'name2']
>>> result = sorted(catalog.keys())
>>> print(' '.join(result))
age age2 message message2 name name2
Nuke the catalog and intids in the end, so as not to confuse
other tests::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
>>> getRootFolder()['herd'] = herd
Traceback (most recent call last):
...
KeyError: u'name'
KeyError:...
>>> from zope.site.hooks import setSite
>>> setSite(herd)
Expand Down
9 changes: 4 additions & 5 deletions src/grokcore/catalog/ftests/catalog/indexes_nonexistent.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
Let's set up a site in which we manage a couple of objects::
(Note how the test output needs to be on one line to please to
IGNORE_EXCEPTION_MODULE_IN_PYTHON2 normalizer)
>>> herd = Herd()
>>> getRootFolder()['herd'] = herd
Traceback (most recent call last):
...
GrokError: grokcore.catalog.Indexes in <module
'grokcore.catalog.ftests.catalog.indexes_nonexistent' from ...>
refers to an attribute or method 'foo' on interface <InterfaceClass
grokcore.catalog.ftests.catalog.indexes_nonexistent.IMammoth>,
but this does not exist.
martian.error.GrokError: grokcore.catalog.Indexes in <module 'grokcore.catalog.ftests.catalog.indexes_nonexistent' from ...> refers to an attribute or method 'foo' on interface <InterfaceClass grokcore.catalog.ftests.catalog.indexes_nonexistent.IMammoth>, but this does not exist.
Nuke the catalog and intids in the end, so as not to confuse
other tests::
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/catalog/ftests/catalog/indexes_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import grokcore.site
import grokcore.catalog
from grokcore.content import Container, Model
from zope.interface import implements, Interface, Attribute
from zope.interface import implementer, Interface, Attribute


class Herd(Container, grokcore.site.Application):
Expand All @@ -67,8 +67,8 @@ class MammothIndexes(grokcore.catalog.Indexes):
features = grokcore.catalog.Set()


@implementer(IMammoth)
class Mammoth(Model):
implements(IMammoth)

def __init__(self, name, features):
self.name = name
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/catalog/ftests/catalog/indexes_valueindex.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import grokcore.site
import grokcore.catalog
from grokcore.content import Container, Model
from zope.interface import implements, Interface, Attribute
from zope.interface import implementer, Interface, Attribute


class Herd(Container, grokcore.site.Application):
Expand All @@ -69,8 +69,8 @@ class SabreToothIndexes(grokcore.catalog.Indexes):
feature = grokcore.catalog.Value()


@implementer(ISabreTooth)
class SabreTooth(Model):
implements(ISabreTooth)

def __init__(self, name, features):
self.name = name
Expand Down
4 changes: 2 additions & 2 deletions src/grokcore/catalog/ftests/catalog/setuporder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
>>> from zope.component import getUtility
>>> catalog = getUtility(ICatalog)
>>> for obj in catalog.searchResults(name=('Ellie', 'Ellie')):
... print obj.name
... print(obj.name)
Ellie
Nuke the catalog and intids in the end, so as not to confuse
Expand Down Expand Up @@ -54,8 +54,8 @@ class IMammoth(interface.Interface):
name = interface.Attribute('Name')


@interface.implementer(IMammoth)
class Mammoth(Model):
interface.implements(IMammoth)

def __init__(self, name):
self.name = name
Expand Down
Loading

0 comments on commit 262314f

Please sign in to comment.