Skip to content

Commit

Permalink
fix: address CI warnings introduced by #580 (#594)
Browse files Browse the repository at this point in the history
  • Loading branch information
disrupted authored Jan 16, 2025
1 parent b516ecf commit 4372004
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 5 additions & 2 deletions kpops/cli/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import annotations

from collections.abc import Iterable, Iterator
from pathlib import Path
from glob import glob
from pathlib import Path

from kpops.const.file_type import PIPELINE_YAML

Expand All @@ -25,7 +25,10 @@ def collect_pipeline_paths(pipeline_paths: Iterable[Path]) -> Iterator[Path]:
# docs.python.org/3.13#pathlib.Path.glob, probably it make sense to use it after ugprading,
# likely the code will look like:
# yield from sorted(pipeline_path.glob(f"**/{PIPELINE_YAML}", recurse_symlinks=True))
yield from sorted(Path(p).resolve() for p in glob(f"{pipeline_path}/**/{PIPELINE_YAML}", recursive=True))
yield from sorted(
Path(p).resolve()
for p in glob(f"{pipeline_path}/**/{PIPELINE_YAML}", recursive=True) # noqa: PTH207
)
else:
msg = f"The entered pipeline path '{pipeline_path}' should be a directory or file."
raise ValueError(msg)
16 changes: 11 additions & 5 deletions tests/pipeline/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -893,28 +893,34 @@ def test_symlinked_pipeline_as_original_pipeline(
RESOURCE_PATH / "pipeline-symlinked" / PIPELINE_YAML,
)

assert pipeline_original == pipeline_symlinked
assert pipeline_original.to_yaml() == pipeline_symlinked.to_yaml()

@pytest.mark.skip( # FIXME
reason="pipeline folder is currently CLI-only feature, cannot test this using current API method"
)
def test_symlinked_folder_renders_as_original_folder_pipeline(
self,
):
pipeline_original = kpops.generate(
RESOURCE_PATH / "first-pipeline" / PIPELINE_YAML,
RESOURCE_PATH / "first-pipeline",
)
pipeline_symlinked = kpops.generate(
RESOURCE_PATH / "symlinked-folder" / PIPELINE_YAML,
RESOURCE_PATH / "symlinked-folder",
)

assert pipeline_original == pipeline_symlinked

@pytest.mark.skip( # FIXME
reason="pipeline folder is currently CLI-only feature, cannot test this using current API method"
)
def test_symlinked_folder_and_pipelines_with_normal_pipeline_render_as_original(
self,
):
pipeline_original = kpops.generate(
RESOURCE_PATH / "pipeline-folders" / PIPELINE_YAML,
RESOURCE_PATH / "pipeline-folders",
)
pipeline_symlinked = kpops.generate(
RESOURCE_PATH / "pipeline-folders-with-symlinks" / PIPELINE_YAML,
RESOURCE_PATH / "pipeline-folders-with-symlinks",
)

assert pipeline_original == pipeline_symlinked

0 comments on commit 4372004

Please sign in to comment.