Skip to content

Commit

Permalink
- more flake8 fixes, changelog entries
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Oct 15, 2019
1 parent c5451d1 commit 6c54dab
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 33 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,12 @@ Changelog
4.0.3 (unreleased)
------------------

- more package cleanups

- cleaned up ZMI views for Zope 4

- fixed several errors due to changed behavior in Python 3


4.0.2 (2019-02-17)
------------------
Expand Down
4 changes: 2 additions & 2 deletions setup.cfg
Expand Up @@ -29,7 +29,6 @@ ignore =
N812,
# For now also ignore following checks:
T000

exclude =
bootstrap.py
no-accept-encodings = True
Expand All @@ -44,8 +43,9 @@ omit =

[coverage:report]
precision = 2
show_missing = True
show_missing = False
sort = Name
fail_under = 50.00

[coverage:html]
directory = _build/coverage
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -12,7 +12,8 @@
#
##############################################################################

from setuptools import setup, find_packages
from setuptools import find_packages
from setuptools import setup


def _read(fname):
Expand Down
Expand Up @@ -21,12 +21,13 @@
except ImportError: # Python 2
from cgi import escape
import logging
import socket
import time
from operator import itemgetter

from six.moves.http_client import HTTPConnection
from six.moves.urllib.parse import quote
from six.moves.urllib.parse import urlparse
import socket
import time

from AccessControl.class_init import InitializeClass
from AccessControl.Permissions import view_management_screens
Expand All @@ -37,6 +38,7 @@
from OFS.Cache import CacheManager
from OFS.SimpleItem import SimpleItem


logger = logging.getLogger('Zope.AcceleratedHTTPCacheManager')


Expand Down
6 changes: 4 additions & 2 deletions src/Products/StandardCacheManagers/RAMCacheManager.py
Expand Up @@ -18,10 +18,11 @@
from html import escape
except ImportError: # Python 2
from cgi import escape
import time
from operator import itemgetter
from six.moves._thread import allocate_lock

import six
import time
from six.moves._thread import allocate_lock

from AccessControl.class_init import InitializeClass
from AccessControl.Permissions import view_management_screens
Expand All @@ -31,6 +32,7 @@
from OFS.Cache import CacheManager
from OFS.SimpleItem import SimpleItem


try:
from cPickle import Pickler
from cPickle import HIGHEST_PROTOCOL
Expand Down
8 changes: 3 additions & 5 deletions src/Products/StandardCacheManagers/__init__.py
Expand Up @@ -14,23 +14,21 @@
Some standard Zope cache managers.
'''

from . import RAMCacheManager
from . import AcceleratedHTTPCacheManager
from . import RAMCacheManager


def initialize(context):
context.registerClass(
RAMCacheManager.RAMCacheManager,
constructors=(RAMCacheManager.manage_addRAMCacheManagerForm,
RAMCacheManager.manage_addRAMCacheManager),
icon="cache.gif"
)
icon="cache.gif")

context.registerClass(
AcceleratedHTTPCacheManager.AcceleratedHTTPCacheManager,
constructors=(
AcceleratedHTTPCacheManager.manage_addAcceleratedHTTPCacheManagerForm, # NOQA
AcceleratedHTTPCacheManager.manage_addAcceleratedHTTPCacheManager,
),
icon="cache.gif"
)
icon="cache.gif")
Expand Up @@ -16,10 +16,10 @@

import unittest

from Products.StandardCacheManagers.AcceleratedHTTPCacheManager import (
AcceleratedHTTPCache,
AcceleratedHTTPCacheManager,
)
from Products.StandardCacheManagers.AcceleratedHTTPCacheManager import \
AcceleratedHTTPCache
from Products.StandardCacheManagers.AcceleratedHTTPCacheManager import \
AcceleratedHTTPCacheManager


class DummyObject(object):
Expand Down Expand Up @@ -123,7 +123,7 @@ def _makeOne(self, *args, **kw):
def _makeContext(self):
from OFS.Folder import Folder
root = Folder()
root.getPhysicalPath = lambda: ('', 'some_path', )
root.getPhysicalPath = lambda: ('', 'some_path')
cm_id = 'http_cache'
manager = self._makeOne(cm_id)
root._setObject(cm_id, manager)
Expand Down
Expand Up @@ -14,25 +14,22 @@
""" Unit tests for AcceleratedCacheManager module.
"""

import Products.StandardCacheManagers
import transaction
import zope.component

from zope.component import testing as componenttesting
from zope.component import eventtesting

from AccessControl import SecurityManager
from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager
from OFS.tests.testCopySupport import CopySupportTestBase
from OFS.tests.testCopySupport import UnitTestSecurityPolicy
from OFS.tests.testCopySupport import UnitTestUser

from Zope2.App import zcml
from Products.StandardCacheManagers.AcceleratedHTTPCacheManager import \
AcceleratedHTTPCacheManager
from Products.StandardCacheManagers.RAMCacheManager import RAMCacheManager
from Products.StandardCacheManagers.AcceleratedHTTPCacheManager import (
AcceleratedHTTPCacheManager,
)
import Products.StandardCacheManagers
from Zope2.App import zcml
from zope.component import eventtesting
from zope.component import testing as componenttesting


CACHE_META_TYPES = tuple(dict(name=instance_class.meta_type,
action='unused_constructor_name',
Expand Down
22 changes: 16 additions & 6 deletions tox.ini
Expand Up @@ -10,9 +10,8 @@ envlist =

[testenv]
commands =
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
{envbindir}/buildout -c {toxinidir}/buildout.cfg buildout:directory={envdir} buildout:develop={toxinidir} install test
coverage run {envbindir}/test -v1
coverage run {envbindir}/test
skip_install = true
deps =
setuptools
Expand All @@ -24,20 +23,31 @@ setenv =

[testenv:coverage]
basepython = python3.7
deps = coverage
deps = {[testenv]deps}
setenv =
COVERAGE_FILE=.coverage
commands =
coverage erase
coverage combine
coverage html
coverage xml
coverage report --fail-under=50
coverage html -i
coverage report -i

[testenv:flake8]
basepython = python3.7
deps =
isort
flake8
# helper to generate HTML reports:
flake8-html
# Useful flake8 plugins that are Python and Plone specific:
flake8-coding
flake8-debugger
flake8-deprecated
flake8-todo
flake8-isort
mccabe
flake8-blind-except
flake8-commas
commands =
- isort --check-only --recursive {toxinidir}/src setup.py
flake8 --doctests src tests setup.py {posargs}

0 comments on commit 6c54dab

Please sign in to comment.