Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/brpm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def find_root():
if "avoid-pep8-E402-import-not-top-of-file":
# Use the util functions from cloudinit
sys.path.insert(0, find_root())
from cloudinit import subp, templater, util
from cloudinit import subp, templater, temp_utils, util


# Subdirectories of the ~/rpmbuild dir
Expand Down Expand Up @@ -83,7 +83,7 @@ def read_version_from_meson():
[
"meson",
"setup",
"builddir",
builddir,
"-Dinit_system=systemd",
"-Ddisable_sshd_keygen=true",
]
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ lint.ignore = [
"D403", # docstring: capitalized first line
"E731", # Do not assign a `lambda` expression, use a `def`
]
extend-include = ["*read-dependencies", "*bddeb", "*brpm"]

[tool.ruff.lint.pydocstyle]
convention = "pep257"
9 changes: 9 additions & 0 deletions tests/unittests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,15 @@ def skipUnlessJsonSchema():
)


def skipUnlessJinjaVersionGreaterThan(version=(0, 0, 0)):
Comment thread
holmanb marked this conversation as resolved.
import jinja2

return pytest.mark.skipif(
tuple(map(int, jinja2.__version__.split("."))) < version,
reason=f"jinj2 version is less than {version}",
)


@contextmanager
def does_not_raise():
"""Context manager to parametrize tests raising and not raising exceptions
Expand Down
2 changes: 2 additions & 0 deletions tests/unittests/test_render_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from cloudinit import subp, templater, util
from tests.helpers import cloud_init_project_dir
from tests.unittests.helpers import skipUnlessJinjaVersionGreaterThan

# TODO(Look to align with tools.render-template or cloudinit.distos.OSFAMILIES)
DISTRO_VARIANTS = [
Expand Down Expand Up @@ -203,6 +204,7 @@ class TestRenderSourcesList:
),
],
)
@skipUnlessJinjaVersionGreaterThan((3, 0, 0))
def test_render_sources_list_templates(
self, tmpdir, template_path, expected
):
Expand Down
20 changes: 17 additions & 3 deletions tools/read-dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,22 @@ CI_SYSTEM_BASE_PKGS = {
"freebsd": [f"{FREEBSD_PKG_PREFIX}tox"],
"redhat": ["python3-tox"],
"centos": ["python3-tox"],
"ubuntu": ["make", "devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"],
"debian": ["make", "devscripts", "python3-dev", "libssl-dev", "tox", "sbuild"],
"ubuntu": [
"make",
"devscripts",
"python3-dev",
"libssl-dev",
"tox",
"sbuild",
],
"debian": [
"make",
"devscripts",
"python3-dev",
"libssl-dev",
"tox",
"sbuild",
],
}


Expand Down Expand Up @@ -363,7 +377,7 @@ def pkg_install(pkg_list, distro, test_distro=False, dry_run=False):
if test_distro:
pkg_list = list(pkg_list) + CI_SYSTEM_BASE_PKGS["common"]
if distro not in ("freebsd",):
pkg_list += CI_SYSTEM_BASE_PKGS["linux_common"]
pkg_list += CI_SYSTEM_BASE_PKGS["linux_common"]
distro_base_pkgs = CI_SYSTEM_BASE_PKGS.get(distro, [])
pkg_list += distro_base_pkgs
print(
Expand Down
Loading