Skip to content

Commit

Permalink
Python 3 and move to github CI
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschulz authored and tomgross committed Aug 28, 2021
1 parent aee8cf9 commit 2f69bb1
Show file tree
Hide file tree
Showing 15 changed files with 183 additions and 183 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: collective.handlebars CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.7, 2.7]
plone-version: [5.2, 5.1]
exclude:
- python-version: 3.8
plone-version: 5.1
- python-version: 3.7
plone-version: 5.1
steps:
# git checkout
- uses: actions/checkout@v2

# python setup
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

# python cache
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# python install
- name: pip install
run: pip install -r requirements.txt

# buildout
- name: buildout
run: buildout -t 10 -c plone-${{ matrix.plone-version }}.x.cfg code-analysis:return-status-codes=True

# code analysis
- name: code analysis
run: bin/code-analysis

# test
- name: test
run: bin/coverage run bin/test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ report.html
.*.cfg
.Python
Pipfile*
.idea
pyvenv.cfg
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

6 changes: 4 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ Changelog
1.5 (unreleased)
----------------

- Nothing changed yet.
- Python 3 / Plone 5.2 compatibility
- Update dependencies
- Move to Github CI


1.4.1 (2018-10-22)
------------------

- Add div-element to wrapper to support cases where only text is provided
(otherwise plone.protect can fail)
(otherwise plone.protect can fail)
[tomgross]

1.4 (2018-09-10)
Expand Down
31 changes: 4 additions & 27 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[buildout]
extends = https://raw.github.com/collective/buildout.plonetest/master/test-5.1.x.cfg
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.2.x.cfg
versions.cfg
package-name = collective.handlebars
package-extras = [test]
parts +=
Expand All @@ -26,29 +28,4 @@ flake8-extensions =
flake8-coding


[versions]
# Don't use a released version of collective.handlebars
collective.handlebars =
PyMeta3 = 0.5.1
PyYAML = 3.13
chardet = 3.0.4
check-manifest = 0.37
configparser = 3.5.0
coverage = 4.0.3
flake8 = 3.0.4
flake8-blind-except = 0.1.1
flake8-coding = 1.3.1
flake8-debugger = 1.4.0
idna = 2.6
mccabe = 0.5.3
plone.recipe.codeanalysis = 3.0.1
plone.recipe.zope2instance = 4.4.0
plone.testing = 5.0.0
pybars3 = 0.9.6
pycodestyle = 2.0.0
pyflakes = 1.2.3
python-coveralls = 2.7.0
setuptools = 33.1.1
sh = 1.12.14
zc.buildout = 2.12.2
zc.recipe.egg = 2.0.6

32 changes: 32 additions & 0 deletions plone-5.1.x.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.1.x.cfg
versions.cfg
package-name = collective.handlebars
package-extras = [test]
parts +=
coverage
code-analysis


[coverage]
recipe = zc.recipe.egg
eggs =
${test:eggs}
coverage
python-coveralls


[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}/src/collective
flake8-exclude = bootstrap.py,bootstrap-buildout.py,docs,*.egg.,omelette
flake8-max-complexity = 15
flake8-extensions =
flake8-blind-except
flake8-debugger
flake8-coding

[versions]
plone.testing = 5.0.0
six = 1.16.0
28 changes: 28 additions & 0 deletions plone-5.2.x.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-5.2.x.cfg
versions.cfg
package-name = collective.handlebars
package-extras = [test]
parts +=
coverage
code-analysis


[coverage]
recipe = zc.recipe.egg
eggs =
${test:eggs}
coverage
python-coveralls


[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}/src/collective
flake8-exclude = bootstrap.py,bootstrap-buildout.py,docs,*.egg.,omelette
flake8-max-complexity = 15
flake8-extensions =
flake8-blind-except
flake8-debugger
flake8-coding
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
setuptools==33.1.1
zc.buildout==2.12.2
setuptools==42.0.2
zc.buildout==2.13.4
wheel
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@
"Framework :: Plone",
"Framework :: Plone :: 5.0",
"Framework :: Plone :: 5.1",
"Framework :: Plone :: 5.2",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Operating System :: OS Independent",
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
"Development Status :: 5 - Production/Stable"
],
keywords='Python Plone',
author='Tom Gross',
Expand All @@ -43,6 +47,7 @@
'Products.GenericSetup>=1.8.2',
'setuptools',
'pybars3',
'six'
],
extras_require={
'test': [
Expand Down
7 changes: 4 additions & 3 deletions src/collective/handlebars/browser/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from zope.i18n import translate

import os.path
import six
import sys

try:
Expand Down Expand Up @@ -63,9 +64,9 @@ def _get_hbs_template(self, hbs_filename):
compiled_template = HBS_REGISTRY[hbs_filename]
else:
with open(hbs_filename) as f:
hbs_template = unicode(f.read(), 'utf-8')
compiled_template = compiler.compile(hbs_template)
HBS_REGISTRY[hbs_filename] = compiled_template
hbs_template = six.ensure_text(f.read())
compiled_template = compiler.compile(hbs_template)
HBS_REGISTRY[hbs_filename] = compiled_template
return compiled_template

def get_partials(self, hbs_dir):
Expand Down
66 changes: 0 additions & 66 deletions src/collective/handlebars/tests/robot/test_example.robot

This file was deleted.

28 changes: 0 additions & 28 deletions src/collective/handlebars/tests/test_robot.py

This file was deleted.

26 changes: 21 additions & 5 deletions src/collective/handlebars/tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@
import unittest


try:
from Products.CMFPlone.utils import get_installer
except ImportError: # pragma: no cover
# Quick shim for 5.1 api change

class get_installer(object): # noqa
def __init__(self, portal, request): # noqa
self.installer = api.portal.get_tool(name='portal_quickinstaller')

def is_product_installed(self, name):
return self.installer.isProductInstalled(name)

def uninstall_product(self, name):
return self.installer.uninstallProducts([name])


class TestSetup(unittest.TestCase):
"""Test that collective.handlebars is properly installed."""

Expand All @@ -14,11 +30,11 @@ class TestSetup(unittest.TestCase):
def setUp(self):
"""Custom shared utility setup for tests."""
self.portal = self.layer['portal']
self.installer = api.portal.get_tool('portal_quickinstaller')
self.installer = get_installer(self.portal, self.layer["request"])

def test_product_installed(self):
"""Test if collective.handlebars is installed."""
self.assertTrue(self.installer.isProductInstalled(
self.assertTrue(self.installer.is_product_installed(
'collective.handlebars'))

def test_browserlayer(self):
Expand All @@ -35,12 +51,12 @@ class TestUninstall(unittest.TestCase):

def setUp(self):
self.portal = self.layer['portal']
self.installer = api.portal.get_tool('portal_quickinstaller')
self.installer.uninstallProducts(['collective.handlebars'])
self.installer = get_installer(self.portal, self.layer["request"])
self.installer.uninstall_product('collective.handlebars')

def test_product_uninstalled(self):
"""Test if collective.handlebars is cleanly uninstalled."""
self.assertFalse(self.installer.isProductInstalled(
self.assertFalse(self.installer.is_product_installed(
'collective.handlebars'))

def test_browserlayer_removed(self):
Expand Down
Loading

0 comments on commit 2f69bb1

Please sign in to comment.