Skip to content

Commit 8691f20

Browse files
Add test for indentation error hint in bitbucket CI yaml
1 parent 9553a0b commit 8691f20

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/usethis/_interface/test_interface_ci.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,26 @@ def test_maximal_config(self, tmp_path: Path):
6565
Path(__file__).parent / "maximal_bitbucket_pipelines.yml"
6666
).read_text()
6767
assert (tmp_path / "bitbucket-pipelines.yml").read_text() == expected_yml
68+
69+
def test_incorrect_indentation(self, tmp_path: Path):
70+
# Arrange
71+
(tmp_path / "bitbucket-pipelines.yml").write_text("""\
72+
- path: /
73+
backend:
74+
serviceName: <service_name>
75+
servicePort: <port>
76+
""")
77+
# Use something like pre-commit so we try and modify the file
78+
(tmp_path / ".pre-commit-config.yaml").touch()
79+
80+
# Act
81+
runner = CliRunner()
82+
with change_cwd(tmp_path):
83+
result = runner.invoke(app)
84+
85+
# Assert
86+
assert result.exit_code == 1, result.output
87+
assert "mapping values are not allowed here" in result.output
88+
assert (
89+
"Hint: You may have incorrect indentation the YAML file." in result.output
90+
)

0 commit comments

Comments
 (0)