Skip to content

Commit 9f205ee

Browse files
committed
release: 🔖 version 0.11.2
2 parents f6827fc + 3fcaf92 commit 9f205ee

4 files changed

Lines changed: 52 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.11.2] - 2026-06-25
9+
10+
Full changelog: https://github.com/crs4/rocrate-validator/compare/0.11.1...0.11.2
11+
12+
### 🐛 Fixed
13+
14+
- fix(cli): use Path type for `--output-file` option so Click returns a `pathlib.Path` rather than a plain string ([31f3785e](https://github.com/crs4/rocrate-validator/commit/31f3785e))
15+
816
## [0.11.1] - 2026-06-25
917

1018
Full changelog: https://github.com/crs4/rocrate-validator/compare/0.11.0...0.11.1

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
[tool.poetry]
1616
name = "roc-validator"
17-
version = "0.11.1"
17+
version = "0.11.2"
1818
description = "A Python package to validate RO-Crates"
1919
authors = [
2020
"Marco Enrico Piras <kikkomep@crs4.it>",

rocrate_validator/cli/commands/validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def validate_uri(ctx, param, value):
199199
@click.option(
200200
"-o",
201201
"--output-file",
202-
type=click.Path(),
202+
type=click.Path(path_type=Path),
203203
default=None,
204204
show_default=True,
205205
help="Path to the output file for the validation report",

tests/test_cli.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import json
1516
import re
1617
from pathlib import Path
1718
from unittest.mock import patch
@@ -146,6 +147,47 @@ def mock_validate(*args, **kwargs):
146147
)
147148

148149

150+
def test_validate_output_file_text_report(cli_runner: CliRunner, tmp_path: Path):
151+
output_file = tmp_path / "report.txt"
152+
result = cli_runner.invoke(
153+
cli,
154+
[
155+
"validate",
156+
str(ValidROC().wrroc_paper_long_date),
157+
"--verbose",
158+
"--no-paging",
159+
"-o",
160+
str(output_file),
161+
],
162+
)
163+
assert result.exit_code == 0, result.output
164+
assert "AttributeError" not in result.output
165+
assert output_file.exists(), "The text report file was not created"
166+
assert output_file.read_text(encoding="utf-8").strip(), "The text report file is empty"
167+
168+
169+
def test_validate_output_file_json_report(cli_runner: CliRunner, tmp_path: Path):
170+
output_file = tmp_path / "report.json"
171+
result = cli_runner.invoke(
172+
cli,
173+
[
174+
"validate",
175+
str(ValidROC().wrroc_paper_long_date),
176+
"--no-paging",
177+
"--output-format",
178+
"json",
179+
"-w",
180+
"10000",
181+
"-o",
182+
str(output_file),
183+
],
184+
)
185+
assert result.exit_code == 0, result.output
186+
assert "AttributeError" not in result.output
187+
assert output_file.exists(), "The JSON report file was not created"
188+
json.loads(output_file.read_text(encoding="utf-8")) # must be valid JSON
189+
190+
149191
def test_validate_with_invalid_profiles_path_dir(cli_runner: CliRunner):
150192
dummy_profiles_path = "/tmp/dummy_profiles"
151193
result = cli_runner.invoke(

0 commit comments

Comments
 (0)