diff --git a/.moban.dt/bears-setup.cfg.jj2 b/.moban.dt/bears-setup.cfg.jj2 new file mode 100644 index 0000000000..3e594df5bb --- /dev/null +++ b/.moban.dt/bears-setup.cfg.jj2 @@ -0,0 +1,5 @@ +{% extends 'setup.cfg.jj2' %} +{% set packages = ['bears', '.ci'] %} +{% block extra_pytest_addopts %} + --ignore=tests/python/bandit_test_files/ +{% endblock %} diff --git a/.moban.yaml b/.moban.yaml index f95dc12e61..ab2a6b1e46 100644 --- a/.moban.yaml +++ b/.moban.yaml @@ -1,4 +1,4 @@ -overrides: bear-requirements.yaml +overrides: .nocover.yaml name: coala-bears description: "Bears for coala (Code Analysis Application)" @@ -11,6 +11,8 @@ branch: master package_module: bears docs_source_dir: API docs_dir: docs +test_prevent_skips: false + entry_points: coalabears: - coala_official_bears = bears @@ -25,6 +27,7 @@ configuration: configuration_dir: ../coala-mobans/ targets: - setup.py: bears-setup.py.jj2 + - setup.cfg: bears-setup.cfg.jj2 - requirements.txt: requirements.txt.jj2 - test-requirements.txt: bears-test-requirements.txt.jj2 - bears/VERSION: VERSION.jj2 diff --git a/.nocover.yaml b/.nocover.yaml new file mode 100644 index 0000000000..266939e274 --- /dev/null +++ b/.nocover.yaml @@ -0,0 +1,6 @@ +overrides: bear-requirements.yaml + +allow_generic_no_cover: true + +nocover_file_globs: + - .ci/* diff --git a/setup.cfg b/setup.cfg index 404a76eb46..2f642d25e0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,28 +2,45 @@ python-tag = py34.py35.py36 [tool:pytest] -norecursedirs = - .git - dist - build - venv - .env - .vendor - vendor - tests/python/bandit_test_files - tests/python/pyroma_test_files +minversion = 3.6.1 + +testpaths = + bears + tests + python_files = *Test.py python_classes = *Test -timeout = 35 + addopts = - --color=yes - --ignore=test-requirements.txt - --profile + -r a + -p no:logging + --color=yes + --doctest-glob=*.rst + --doctest-modules + --doctest-ignore-import-error + --cov + --instafail + --profile + --reorder 'requirements.txt' 'test-requirements.txt' '*' + --ignore=tests/python/bandit_test_files/ + +doctest_optionflags = + ELLIPSIS + IGNORE_EXCEPTION_DETAIL + env = - PYTHONHASHSEED=0 -# PYTHONHASHSEED=0 is required to use same hashes in pytests-xdist's workers + PYTEST=1 + python_paths = .ci/ +reqsfilenamepatterns = + requirements.txt + test-requirements.txt + +reqsignorevcs = True + +timeout = 35 + [coverage:coverage_env_plugin] markers = True @@ -42,7 +59,6 @@ omit = tests/* setup.py .ci/* - tests/python/bandit_test_files/ [coverage:report] fail_under = 100 diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000000..c5ec1fb7cb --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,10 @@ +# Allow import to fail to avoid annoying developers +try: + from pytest_reqs import check_requirements +except ImportError: + check_requirements = None + + +if check_requirements: + def pytest_collection_modifyitems(config, session, items): + check_requirements(config, session, items)