Skip to content

Commit

Permalink
CI: fix reported issues
Browse files Browse the repository at this point in the history
* backends.puppetdb: fix urllib3 import. More recent versions of
  requests don't ship urllib3 embedded, import that directly.
* Add max version limit for Jinja2 in the tests-min environment, it
  breaks the old Sphinx version with more recent versions.
* Fix newly reported issues by pylint.
* doc: set default language. Latest Sphinx 5.0 release requires
  language to not be None, it raises a warning otherwise, and we
  fail on warnings.

Change-Id: I311266e9f267dcd7c3633eab12999bd5685f1b3d
  • Loading branch information
volans- committed Jul 12, 2022
1 parent 500e83d commit feebf58
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions cumin/backends/puppetdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

import pyparsing as pp
import requests

from requests.packages import urllib3
import urllib3

from cumin import nodeset, nodeset_fromlist
from cumin.backends import BaseQuery, InvalidQueryError
Expand Down
2 changes: 1 addition & 1 deletion cumin/tests/integration/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def test_timeout(self, capsys):
assert _EXPECTED_LINES['failed'] not in err, _EXPECTED_LINES['failed']
assert rc == 2

def test_version(self, capsys): # pylint: disable=no-self-use
def test_version(self, capsys):
"""Calling --version should return the version and exit."""
with pytest.raises(SystemExit) as e:
cli.main(argv=['--version'])
Expand Down
3 changes: 2 additions & 1 deletion cumin/tests/unit/test_grammar.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def test_backend_import_error(mocked_import_modules):
"""If an internal backend raises ImportError because of missing dependencies, it should be skipped."""
mocked_import_modules.side_effect = ImportError
backends = grammar.get_registered_backends()
assert backends == {}
assert not backends
assert isinstance(backends, dict)


@mock.patch('cumin.grammar.importlib.import_module')
Expand Down
3 changes: 2 additions & 1 deletion cumin/tests/unit/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ def test_config_class_valid():
def test_config_class_empty():
"""An empty dictionary is returned if the configuration is empty."""
config = cumin.Config(config=get_fixture_path(os.path.join('config', 'empty', 'config.yaml')))
assert config == {}
assert not config
assert isinstance(config, dict)


def test_config_class_invalid():
Expand Down
2 changes: 1 addition & 1 deletion cumin/tests/unit/transports/test_init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Transport tests."""
# pylint: disable=protected-access,no-self-use
# pylint: disable=protected-access
from unittest import mock

import pytest
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
language = 'en'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
# generate the manpage during the Debian build process.
extras_require['tests-min'] = [dep.split(',')[0].replace('>=', '==') if dep.lower().startswith('sphinx') else dep
for dep in extras_require['tests']]
# Add Jinja2 upper limit for min-tests, it breaks with more recent versions
extras_require['tests-min'].append('jinja2<3.1.0')
# Add optional dependencies to the tests ones
extras_require['tests'].extend(extras_require['with-openstack'])
extras_require['tests-min'].extend(dep.replace('>=', '==') for dep in extras_require['with-openstack'])
Expand Down

0 comments on commit feebf58

Please sign in to comment.