diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b194864..e15fb56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,6 +49,8 @@ jobs: python-version: ${{ matrix.python-version }} - run: python -m pip install 'tox<4' - run: tox -e tests + env: + COVERAGE_FILE: .coverage.${{ matrix.python-version }} - name: Upload coverage file uses: actions/upload-artifact@v3 with: diff --git a/pyproject.toml b/pyproject.toml index c09a77a..faccfca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,9 +74,7 @@ jobs = 0 # Use one process for CPU. load-plugins = [ "pylint.extensions.bad_builtin", "pylint.extensions.check_elif", - "pylint.extensions.comparetozero", "pylint.extensions.docparams", - "pylint.extensions.emptystring", "pylint.extensions.mccabe", "pylint.extensions.overlapping_exceptions", "pylint.extensions.redefined_variable_type", @@ -95,6 +93,8 @@ enable = [ "deprecated-pragma", "useless-suppression", "use-symbolic-message-instead", + "use-implicit-booleaness-not-comparison-to-zero", + "use-implicit-booleaness-not-comparison-to-string", ] disable = [ # Docstrings are encouraged but we don't want to enforce that everything diff --git a/setup.cfg b/setup.cfg index 1536cbc..d3495a8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -18,7 +18,6 @@ package_dir = packages = find: python_requires = >=3.8 install_requires = - importlib_metadata;python_version<"3.8." jsonschema>=4.18 importlib_resources referencing diff --git a/src/h_api/bulk_api/model/data_body.py b/src/h_api/bulk_api/model/data_body.py index bdfd84d..4d0a22d 100644 --- a/src/h_api/bulk_api/model/data_body.py +++ b/src/h_api/bulk_api/model/data_body.py @@ -104,9 +104,6 @@ class _IdRef: # pylint: disable=too-few-public-methods """A value object which represents an id reference or concrete id.""" def __init__(self, value): - # pylint: disable=invalid-name - # We're using "id"... fight me - if isinstance(value, dict): self.id, self.ref = None, value.get("$ref") else: diff --git a/src/h_api/bulk_api/model/report.py b/src/h_api/bulk_api/model/report.py index e878d3d..63414e5 100644 --- a/src/h_api/bulk_api/model/report.py +++ b/src/h_api/bulk_api/model/report.py @@ -14,7 +14,7 @@ def __init__(self, id_, public_id=None): if id_ is None: raise ValueError("id_ is required for successful outcomes") - self.id = id_ # pylint: disable=invalid-name + self.id = id_ self.public_id = id_ if public_id is None else public_id def __repr__(self): diff --git a/src/h_api/model/json_api.py b/src/h_api/model/json_api.py index 6fdd3a4..4f867b0 100644 --- a/src/h_api/model/json_api.py +++ b/src/h_api/model/json_api.py @@ -86,7 +86,7 @@ def create( ) @property - def id(self): # pylint: disable=invalid-name + def id(self): """Get the id.""" return self._data["id"] diff --git a/tests/pyproject.toml b/tests/pyproject.toml index 4b374da..f3a7c5e 100644 --- a/tests/pyproject.toml +++ b/tests/pyproject.toml @@ -4,9 +4,7 @@ jobs = 0 # Use one process for CPU. load-plugins = [ "pylint.extensions.bad_builtin", "pylint.extensions.check_elif", - "pylint.extensions.comparetozero", "pylint.extensions.docparams", - "pylint.extensions.emptystring", "pylint.extensions.mccabe", "pylint.extensions.overlapping_exceptions", "pylint.extensions.redefined_variable_type", @@ -25,6 +23,8 @@ enable = [ "deprecated-pragma", "useless-suppression", "use-symbolic-message-instead", + "use-implicit-booleaness-not-comparison-to-zero", + "use-implicit-booleaness-not-comparison-to-string", ] disable = [ # Docstrings are encouraged but we don't want to enforce that everything diff --git a/tox.ini b/tox.ini index 613f858..cca8eb8 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,7 @@ setenv = dev: NEW_RELIC_ENVIRONMENT = {env:NEW_RELIC_ENVIRONMENT:dev} dev,tests,functests: PYTHONDEVMODE = {env:PYTHONDEVMODE:1} tests,functests: PYTEST_PLUGINS = tests.pytest_plugins.factory_boy + tests: COVERAGE_FILE = {env:COVERAGE_FILE:.coverage.{envname}} passenv = HOME PYTEST_ADDOPTS @@ -31,12 +32,13 @@ deps = format,checkformatting: black format,checkformatting: isort lint: toml - lint: pylint + lint: pylint>=3.0.0 lint: pydocstyle lint: pycodestyle lint,tests: pytest-mock - lint,tests,coverage: coverage[toml] lint,tests,functests: pytest + tests: pytest-coverage + coverage: coverage[toml] lint,tests,functests: factory-boy lint,tests,functests: pytest-factoryboy lint,tests,functests: h-matchers @@ -53,8 +55,8 @@ commands = lint: pylint --rcfile=tests/pyproject.toml tests lint: pydocstyle src tests bin lint: pycodestyle src tests bin - tests: coverage run -m pytest --failed-first --new-first --no-header --quiet {posargs:tests/unit/} + tests: python -m pytest --cov --cov-report= --cov-fail-under=0 --failed-first --new-first --no-header --quiet {posargs:tests/unit/} functests: python -m pytest --failed-first --new-first --no-header --quiet {posargs:tests/functional/} - coverage: -coverage combine + coverage: coverage combine coverage: coverage report template: python3 bin/make_template {posargs}