Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tox improvements and added black as formatter #431

Merged
merged 16 commits into from Mar 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions .editorconfig
@@ -0,0 +1,42 @@
# EditorConfig Configurtaion file, for more details see:
# http://EditorConfig.org
# EditorConfig is a convention description, that could be interpreted
# by multiple editors to enforce common coding conventions for specific
# file types

# top-most EditorConfig file:
# Will ignore other EditorConfig files in Home directory or upper tree level.
root = true

[*] # For All Files
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
# Set default charset
charset = utf-8
# Indent style default
indent_style = space
# Max Line Length - a hard line wrap, should be disabled
max_line_length = off

[*.{py,cfg,ini}]
# 4 space indentation
indent_size = 4

[*.{yml}]
# 2 space indentation
indent_size = 2

[{Makefile,.gitmodules}]
# Tab indentation (no size specified, but view as 4 spaces)
indent_style = tab
indent_size = unset
tab_width = unset

[*.bat]
indent_style = tab
end_of_line = crlf

[LICENSE]
insert_final_newline = false
21 changes: 13 additions & 8 deletions .travis.yml
Expand Up @@ -10,15 +10,20 @@ global:
matrix:
fast_finish: true
include:
# pyXX-plone_sunburst,pyXX-plone_barceloneta
- python: "3.8"
env: TOXENV=isort,lint
- python: "3.7"
env: TOXENV=docs
- python: "2.7"
env: TOXENV=py27-plone-4.3
env: TOXENV=py27-plone-5.2
- python: "2.7"
env: TOXENV=py27-plone-5.0
- python: "2.7"
env: TOXENV=py27-plone-5.1
- python: "2.7"
env: TOXENV=isort,flake8,docs,
env: TOXENV=py27-plone-5.2-archetypes
- python: "3.6"
env: TOXENV=py36-plone-5.2
- python: "3.7"
env: TOXENV=py37-plone-5.2
- python: "3.8"
env: TOXENV=py38-plone-5.2

before_install:
- mkdir -p $HOME/buildout-cache/{downloads,eggs,extends}
Expand All @@ -30,7 +35,7 @@ before_install:
- echo "abi-tag-eggs = true" >> $HOME/.buildout/default.cfg

install:
- travis_retry pip install -U setuptools==33.1.1 tox coveralls coverage
- travis_retry pip install -U pip tox coveralls coverage

script:
- travis_retry tox
Expand Down
4 changes: 2 additions & 2 deletions base.cfg
Expand Up @@ -12,8 +12,8 @@ socket-timeout = 5

[versions]
plone.api =
setuptools = 33.1.1
zc.buildout = 2.8.0
#setuptools = 33.1.1
#zc.buildout = 2.8.0

[omelette]
recipe = collective.recipe.omelette
Expand Down
2 changes: 1 addition & 1 deletion buildout.cfg
@@ -1,2 +1,2 @@
[buildout]
extends = plone-5.1.x.cfg
extends = plone-5.2.x.cfg
4 changes: 4 additions & 0 deletions news/431.feature
@@ -0,0 +1,4 @@
Drop support for Plone 4.3, 5.0, 5.1, add support for 6.0.
The code might still work, but it is no longer tested.
You can use releases in the 1.10 series on the older versions.
[maurits]
8 changes: 8 additions & 0 deletions news/448.feature
@@ -0,0 +1,8 @@
Improve tox.ini so that plone.api could be tested locally.
[loechel]

Add all tests to travis-ci config
[loechel]

Add .editorconfig file to plone.api to help enforce coding conventions
[loechel]
5 changes: 0 additions & 5 deletions plone-5.0.x.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions plone-5.1.x.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion plone-4.3.x.cfg → plone-5.2.x.cfg
@@ -1,4 +1,4 @@
[buildout]
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
https://raw.github.com/collective/buildout.plonetest/master/test-5.2.x.cfg
base.cfg
1 change: 1 addition & 0 deletions pyproject.toml
@@ -1,4 +1,5 @@
[tool.towncrier]
package = "plone.api"
filename = "CHANGES.rst"
directory = "news/"
title_format = "{version} ({project_date})"
Expand Down
7 changes: 3 additions & 4 deletions setup.cfg
Expand Up @@ -8,13 +8,13 @@ exclude =
bootstrap-buildout.py,

ignore =
W503

[isort]
force_alphabetical_sort=True
force_single_line=True
lines_after_imports=2
line_length=200
not_skip=__init__.py

[coverage:run]
branch = True
Expand All @@ -28,15 +28,14 @@ omit =

[coverage:report]
precision = 2
include = src
omit =
*.rst
*/doctests/*
*/tests/*

[coverage:html]
directory = reports/coverage


directory = _build/coverage

[bdist_wheel]
universal = 1
7 changes: 3 additions & 4 deletions setup.py
Expand Up @@ -14,7 +14,7 @@ def read(*rnames):
read('CHANGES.rst') + '\n\n' + \
read('LICENSE')

version = '1.10.5.dev0'
version = '1.11.0.dev0'

setup(
name='plone.api',
Expand Down Expand Up @@ -59,10 +59,8 @@ def read(*rnames):
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Framework :: Plone',
'Framework :: Plone :: 4.3',
'Framework :: Plone :: 5.0',
'Framework :: Plone :: 5.1',
'Framework :: Plone :: 5.2',
'Framework :: Plone :: 6.0',
'Framework :: Plone :: Core',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License v2 (GPLv2)',
Expand All @@ -72,6 +70,7 @@ def read(*rnames):
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
platforms='Any',
)
2 changes: 1 addition & 1 deletion src/plone/api/content.py
Expand Up @@ -50,7 +50,7 @@ def create(
id=None,
title=None,
safe_id=False,
**kwargs # NOQA: C816
**kwargs # NOQA: C816, S101
):
"""Create a new content item.

Expand Down
2 changes: 1 addition & 1 deletion src/plone/api/tests/test_env.py
Expand Up @@ -410,8 +410,8 @@ def test_argument_requirement(self):
def test_debug_mode(self):
"""Tests that the retured value is the same as
getConfiguration.debug_mode."""
from plone.api.env import debug_mode
from App.config import getConfiguration
from plone.api.env import debug_mode
getConfiguration().debug_mode = True
self.assertEqual(debug_mode(), True)
getConfiguration().debug_mode = False
Expand Down
1 change: 1 addition & 0 deletions src/plone/api/tests/test_group.py
Expand Up @@ -153,6 +153,7 @@ def test_get_groups_nonexistant_user(self):

def test_get_groups_anonymous(self):
from AccessControl.users import nobody

# In test the anonymous user is aq wrapped in /plone/acl_users
# > self.portal.acl_users in api.user.get_current().aq_chain
# >>> True
Expand Down