plone.api/read_only_second_approach: Merge pull request #375 from plone/code_conventions_tox

GitHub <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: plone.api
Branch: refs/heads/read_only_second_approach
Date: 2017-07-26T07:30:38+02:00
Author: Jens W. Klein (jensens) <jk-jUMamYRpa/IasaSY4/nUZ7NldLUNz+W/@public.gmane.org>
Commit: https://github.com/plone/plone.api/commit/f1690794a87255976214bbf56efa0d66880498b3

Merge pull request #375 from plone/code_conventions_tox

Code conventions &amp; tox setup

Files changed:
A plone-5.1.x.cfg
A tox.ini
M .gitignore
M CHANGES.rst
M buildout.cfg
M plone-4.3.x.cfg
M plone-5.0.x.cfg
M setup.cfg
M setup.py

diff --git a/.gitignore b/.gitignore
index 0a7685c..fbf9d8e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
 *.mo
-*.pyc
+*.py[cod]
 *~
 /.Python
 /.coverage
@@ -21,3 +21,7 @@
 /share/
 /src/plone.api.egg-info/
 /var/
+/reports/
+/pip-selfcheck.json
+/_build/
+/.tox/
diff --git a/CHANGES.rst b/CHANGES.rst
index 85dcdcf..f7184b9 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -10,7 +10,8 @@ Breaking changes:
 
 New features:
 
-- *add item here*
+- added tox.ini and code convention definitions in setup.py and .editorconfig so that they could be enforced
+  [loechel]
 
 Bug fixes:
 
diff --git a/buildout.cfg b/buildout.cfg
index 02bdfa7..fe9a06a 100644
--- a/buildout.cfg
+++ b/buildout.cfg
@@ -1,10 +1,11 @@
 [buildout]
-extends =
-    https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
-    plone-4.3.x.cfg
+
 package-name = plone.api
-package-extras = [test]
-test-eggs = Pillow
+package-extras = [develop, test]
+test-eggs =
+    Pillow
+    plone.app.contenttypes
+
 parts +=
     omelette
     code-analysis
@@ -34,14 +35,7 @@ debug-statements = True
 return-status-codes = True
 
 [versions]
-flake8 = 2.6.2
-mccabe = 0.5.2
-plone.recipe.codeanalysis = 1.0b5
-pycodestyle = 2.0.0
-pyflakes = 1.2.3
-setuptools = 21.0.0
-zc.buildout = 2.5.3
+plone.api =
 
-# Required by:
-# plone.recipe.codeanalysis==1.0b5
-zptlint = 0.2.4
+setuptools = 33.1.1
+zc.buildout = 2.8.0
\ No newline at end of file
diff --git a/plone-4.3.x.cfg b/plone-4.3.x.cfg
index e69de29..98c10c3 100644
--- a/plone-4.3.x.cfg
+++ b/plone-4.3.x.cfg
@@ -0,0 +1,10 @@
+[buildout]
+extends =
+    https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg
+    buildout.cfg
+
+test-eggs +=
+    plone.app.contenttypes
+
+[versions]
+plone.api =
diff --git a/plone-5.0.x.cfg b/plone-5.0.x.cfg
index d32ca7a..54c048e 100644
--- a/plone-5.0.x.cfg
+++ b/plone-5.0.x.cfg
@@ -1,4 +1,8 @@
 [buildout]
+extends =
+    https://raw.github.com/collective/buildout.plonetest/master/test-5.0.x.cfg
+    buildout.cfg
+
 test-eggs +=
     plone.app.contenttypes
 
diff --git a/plone-5.1.x.cfg b/plone-5.1.x.cfg
new file mode 100644
index 0000000..4ad852b
--- /dev/null
+++ b/plone-5.1.x.cfg
@@ -0,0 +1,10 @@
+[buildout]
+extends =
+    https://raw.github.com/collective/buildout.plonetest/master/test-5.1.x.cfg
+    buildout.cfg
+
+test-eggs +=
+    plone.app.contenttypes
+
+[versions]
+plone.api =
diff --git a/setup.cfg b/setup.cfg
index 927666e..cb8c9d4 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,3 +2,30 @@
 ignore =
     *.cfg
     .travis.yml
+
+[flake8]
+exclude =
+    bootstrap-buildout.py,
+
+ignore =
+
+[isort]
+force_alphabetical_sort=True
+force_single_line=True
+lines_after_imports=2
+line_length=200
+not_skip=__init__.py
+
+[coverage:run]
+branch = True
+source =
+    src
+
+omit =
+    *.rst
+
+[coverage:report]
+precision = 2
+
+[coverage:html]
+directory = reports/coverage
diff --git a/setup.py b/setup.py
index a078ee0..1f339a0 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,7 @@
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
+
 long_description = \
     read('README.rst') + '\n\n' + \
     read('CHANGES.rst') + '\n\n' + \
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..ee8a2f9
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,117 @@
+[tox]
+envlist =
+    py27-plone-{4.3,5.0,5.1},
+    isort,
+    flake8,
+    docs,
+    coverage-report,
+
+skip_missing_interpreters = false
+
+[testenv]
+skip_install = True
+
+basepython:
+    py27: python2.7
+
+extras =
+    test
+
+commands =
+    mkdir -p {toxinidir}/reports/coverage
+    {envbindir}/buildout -c {toxinidir}/{env:BUILDOUT_FILE} buildout:directory={envdir} buildout:develop={toxinidir} bootstrap
+    {envbindir}/buildout -c {toxinidir}/{env:BUILDOUT_FILE} buildout:directory={envdir} buildout:develop={toxinidir}
+    {envbindir}/code-analysis
+    {envbindir}/coverage run {envbindir}/test -v1 --auto-color {posargs}
+
+setenv =
+    COVERAGE_FILE=.coverage.{envname}
+    plone-4.3: BUILDOUT_FILE="plone-4.3.x.cfg"
+    plone-5.0: BUILDOUT_FILE="plone-5.0.x.cfg"
+    plone-5.1: BUILDOUT_FILE="plone-5.1.x.cfg"
+
+deps =
+    pdbpp
+    setuptools==33.1.1
+    zc.buildout==2.8.0
+    coverage
+
+whitelist_externals =
+    mkdir
+
+[testenv:coverage-report]
+basepython = python2.7
+deps = coverage
+
+setenv =
+    COVERAGE_FILE=.coverage
+
+skip_install = true
+
+commands =
+    coverage erase
+    coverage combine
+    coverage report
+    coverage html
+    coverage xml
+
+[testenv:flake8]
+basepython = python2.7
+skip_install = true
+
+deps =
+    flake8
+    flake8-blind-except
+    flake8-coding
+    flake8-commas
+    flake8-debugger
+    flake8-deprecated
+    flake8-isort
+    flake8-pep3101
+    flake8-plone-api
+    flake8-plone-hasattr
+    flake8-print
+    flake8-quotes
+    flake8-string-format
+    flake8-todo
+    flake8_strict
+
+commands =
+    mkdir -p {toxinidir}/reports/flake8
+    - flake8 --format=html --htmldir={toxinidir}/reports/flake8 src setup.py
+    flake8 src setup.py
+
+whitelist_externals =
+    mkdir
+
+[testenv:isort]
+basepython = python2.7
+skip_install = true
+
+deps =
+    isort
+
+commands =
+    isort --check-only --recursive {toxinidir}/src
+
+[testenv:isort-apply]
+basepython = python2.7
+skip_install = true
+
+deps =
+    isort
+
+commands =
+    isort --apply --recursive {toxinidir}/src
+
+
+[testenv:docs]
+basepython = python2.7
+skip_install = false
+
+deps =
+    Sphinx
+
+commands =
+    sphinx-build -b html -d _build/docs/doctrees docs _build/docs/html
+    sphinx-build -b doctest docs _build/docs/doctrees



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.