Browse Source

Refactor test tooling config

Peter Justin 6 years ago
parent
commit
577ebc1aca
5 changed files with 106 additions and 95 deletions
  1. 0 41
      .coveragerc
  2. 1 0
      .gitignore
  3. 1 1
      requirements.txt
  4. 90 0
      setup.cfg
  5. 14 53
      tox.ini

+ 0 - 41
.coveragerc

@@ -1,41 +0,0 @@
-# .coveragerc to control coverage.py
-[run]
-branch = true
-source = flaskbb
-omit =
-    flaskbb/_compat.py
-    flaskbb/configs/*
-parallel = true
-
-[paths]
-source =
-    flaskbb/
-    .tox/*/lib/*/site-packages/flaskbb/
-
-
-[report]
-# Regexes for lines to exclude from consideration
-exclude_lines =
-    # Have to re-enable the standard pragma
-    pragma: no cover
-
-    # Don't complain about missing debug-only code:
-    def __repr__
-    if self\.debug
-
-    # Don't complain if tests don't hit defensive assertion code:
-    raise AssertionError
-    raise NotImplementedError
-
-    # Don't complain if non-runnable code isn't run:
-    if 0:
-    if __name__ == .__main__.:
-
-    @abstractmethod
-
-ignore_errors = True
-precision = 2
-show_missing = true
-
-[html]
-directory = tests/htmlcov

+ 1 - 0
.gitignore

@@ -141,3 +141,4 @@ bower_components
 node_modules
 .DS_Store
 .pytest_cache
+test-results.xml

+ 1 - 1
requirements.txt

@@ -10,7 +10,7 @@ chardet==3.0.4
 click==7.0
 click-log==0.3.2
 enum34==1.1.6 ; python_version<'3.4'
-Flask==1.0.2
+Flask==1.0.3
 Flask-Alembic==2.0.1
 flask-allows==0.7.1
 Flask-BabelPlus==2.1.1

+ 90 - 0
setup.cfg

@@ -1,2 +1,92 @@
 [bdist_wheel]
 universal=1
+
+[metadata]
+license_file = LICENSE
+
+[tool:pytest]
+addopts =
+    -vvl
+    --strict
+    --capture fd
+    --tb short
+    --pythonwarnings error::flaskbb.deprecation.FlaskBBDeprecation
+    --cov flaskbb
+    --cov-config setup.cfg
+    --cov-append
+norecursedirs = node_modules
+
+[tool:isort]
+lines_after_imports=2
+skip_glob=20??????????_*_*.py, node_modules, .tox, docs, build, dist
+not_skip=__init__.py
+known_first_party=flaskbb
+use_parentheses=true
+
+[flake8]
+# B = bugbear
+# E = pycodestyle errors
+# F = flake8 pyflakes
+# W = pycodestyle warnings
+# B9 = bugbear opinions
+ignore = E203, E712, E711, W503
+select = C,E,F,W,B,B9
+max-complexity = 10
+max-line-length = 80
+exclude =
+    # allowed to break the rules
+    flaskbb/configs/default.py,
+    flaskbb/_compat.py,
+    # migrations are autogenerated
+    migrations,
+    # stuff to not inspect at all
+    node_modules,
+    .git,
+    .tox,
+    *.pyc,
+    __pycache__,
+    instance,
+    dist,
+    build,
+    docs
+
+# .coveragerc to control coverage.py
+[coverage:run]
+branch = true
+source = flaskbb
+omit =
+    flaskbb/_compat.py
+    flaskbb/configs/*
+parallel = true
+
+[coverage:paths]
+source =
+    flaskbb/
+    .tox/*/lib/*/site-packages/flaskbb/
+
+[coverage:report]
+# Regexes for lines to exclude from consideration
+exclude_lines =
+    # Have to re-enable the standard pragma
+    pragma: no cover
+
+    # Don't complain about missing debug-only code:
+    def __repr__
+    if self\.debug
+
+    # Don't complain if tests don't hit defensive assertion code:
+    raise AssertionError
+    raise NotImplementedError
+
+    # Don't complain if non-runnable code isn't run:
+    if 0:
+    if __name__ == .__main__.:
+
+    @abstractmethod
+
+ignore_errors = True
+precision = 2
+show_missing = true
+
+[coverage:html]
+directory = tests/htmlcov

+ 14 - 53
tox.ini

@@ -1,9 +1,8 @@
 [tox]
-skip_missing_interpreters=true
+skip_missing_interpreters = true
 envlist =
-    py{35,36,37},
-    flake8,
-    coverage-report
+    py{27,35,36,37},
+    coverage
 
 [testenv]
 use_develop = true
@@ -15,63 +14,25 @@ setenv =
     COVERAGE_FILE = tests/.coverage.{envname}
     PYTHONDONTWRITEBYTECODE=1
 commands =
-    coverage run -m pytest {toxinidir}/tests {toxinidir}/flaskbb {posargs}
+    pytest {toxinidir}/tests {toxinidir}/flaskbb {posargs}
 
-[testenv:coverage-report]
+[testenv:coverage]
 skip_install = true
 deps = coverage
+setenv =
+    COVERAGE_FILE = tests/.coverage
 commands =
-    coverage combine tests
+    coverage combine
     coverage report
 
-[testenv:codecov]
+[testenv:coverage-ci]
 skip_install = true
 deps = codecov
+passenv = CODECOV_TOKEN
+setenv =
+    COVERAGE_FILE = tests/.coverage
 commands =
-    coverage combine tests
+    coverage combine
     codecov
+    coverage xml
     coverage report
-
-[testenv:black]
-skip_install = true
-deps = black
-basepython=python3.7
-commands = black --check tests/ flaskbb/
-
-[testenv:flake8]
-skip_install = true
-basepython=python3.7
-commands =
-    flake8 --version
-    flake8 --config={toxinidir}/tox.ini {toxinidir}/flaskbb {toxinidir}/tests
-
-[flake8]
-# B = bugbear
-# E = pycodestyle errors
-# F = flake8 pyflakes
-# W = pycodestyle warnings
-# B9 = bugbear opinions
-ignore = E203, E712, E711, W503
-select = C,E,F,W,B,B9
-max-complexity = 10
-max-line-length = 88
-exclude =
-    # allowed to break the rules
-    flaskbb/configs/default.py,
-    flaskbb/_compat.py,
-    # migrations are autogenerated
-    migrations,
-    # stuff to not inspect at all
-    node_modules,
-    .git,
-    .tox,
-    *.pyc,
-    __pycache__,
-    instance,
-    dist,
-    build,
-    docs
-
-[pytest]
-addopts =  -vvl --strict --capture fd -W error::flaskbb.deprecation.FlaskBBDeprecation
-norecursedirs = node_modules