Skip to content

Commit 9dab9e0

Browse files
ritwik-gclaude
andcommitted
Fix CI test failures by updating assertions to use result.output instead of result.stderr
- Updated failing tests to check result.output instead of result.stderr since Click's test runner combines stdout/stderr unless specifically configured - Added environment variables to disable color output in both unit and integration test steps - This resolves the "stderr not separately captured" errors in CI 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 67e35b3 commit 9dab9e0

File tree

4 files changed

+21
-15
lines changed

4 files changed

+21
-15
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,16 @@ jobs:
4545
- name: Run unit tests
4646
run: |
4747
uv run pytest tests/ -v --cov=helm_values_manager --cov-report=xml --cov-report=term
48+
env:
49+
FORCE_COLOR: "0"
50+
NO_COLOR: "1"
4851

4952
- name: Run integration tests
5053
run: |
5154
uv run pytest tests/test_integration.py -v
55+
env:
56+
FORCE_COLOR: "0"
57+
NO_COLOR: "1"
5258

5359
- name: Upload coverage to Codecov
5460
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'

tests/test_generator.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ def test_generate_command_validation_fails(tmp_path):
312312
result = runner.invoke(app, ["generate", "--env", "dev"])
313313

314314
assert result.exit_code == 1
315-
assert "Validation failed" in result.stderr
316-
assert "Missing required value: required-field" in result.stderr
315+
assert "Validation failed" in result.output
316+
assert "Missing required value: required-field" in result.output
317317

318318

319319
def test_generate_command_missing_env_var(tmp_path):
@@ -345,7 +345,7 @@ def test_generate_command_missing_env_var(tmp_path):
345345
result = runner.invoke(app, ["generate", "--env", "prod"])
346346

347347
assert result.exit_code == 1
348-
assert "Environment variable 'MISSING_VAR' not found" in result.stderr
348+
assert "Environment variable 'MISSING_VAR' not found" in result.output
349349

350350

351351
def test_generate_command_complex_example(tmp_path, monkeypatch):

tests/test_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def test_error_recovery_workflow(tmp_path):
348348
# 6. Try to generate with validation errors
349349
result = runner.invoke(app, ["generate", "--env", "test"])
350350
assert result.exit_code == 1
351-
assert "Validation failed" in result.stderr
351+
assert "Validation failed" in result.output
352352

353353

354354
def test_schema_evolution_workflow(tmp_path):

tests/test_validate.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_validate_missing_schema(tmp_path):
1515
app, ["validate", "--env", "dev", "--schema", str(tmp_path / "missing.json")]
1616
)
1717
assert result.exit_code == 1
18-
assert "Schema file not found" in result.stderr
18+
assert "Schema file not found" in result.output
1919

2020

2121
def test_validate_invalid_schema_json(tmp_path):
@@ -25,7 +25,7 @@ def test_validate_invalid_schema_json(tmp_path):
2525

2626
result = runner.invoke(app, ["validate", "--env", "dev", "--schema", str(schema_file)])
2727
assert result.exit_code == 1
28-
assert "Invalid JSON in schema file" in result.stderr
28+
assert "Invalid JSON in schema file" in result.output
2929

3030

3131
def test_validate_valid_schema_only(tmp_path):
@@ -77,7 +77,7 @@ def test_validate_duplicate_keys(tmp_path):
7777

7878
result = runner.invoke(app, ["validate", "--env", "dev", "--schema", str(schema_file)])
7979
assert result.exit_code == 1
80-
assert "Duplicate key: database" in result.stderr
80+
assert "Duplicate key: database" in result.output
8181

8282

8383
def test_validate_duplicate_paths(tmp_path):
@@ -106,7 +106,7 @@ def test_validate_duplicate_paths(tmp_path):
106106

107107
result = runner.invoke(app, ["validate", "--env", "dev", "--schema", str(schema_file)])
108108
assert result.exit_code == 1
109-
assert "Duplicate path: database.host" in result.stderr
109+
assert "Duplicate path: database.host" in result.output
110110

111111

112112
def test_validate_invalid_type(tmp_path):
@@ -128,7 +128,7 @@ def test_validate_invalid_type(tmp_path):
128128

129129
result = runner.invoke(app, ["validate", "--env", "dev", "--schema", str(schema_file)])
130130
assert result.exit_code == 1
131-
assert "Invalid schema" in result.stderr or "Invalid type" in result.stderr
131+
assert "Invalid schema" in result.output or "Invalid type" in result.output
132132

133133

134134
def test_validate_values_type_mismatch(tmp_path):
@@ -161,7 +161,7 @@ def test_validate_values_type_mismatch(tmp_path):
161161
["validate", "--env", "dev", "--schema", str(schema_file), "--values", str(values_file)],
162162
)
163163
assert result.exit_code == 1
164-
assert "Type mismatch for port" in result.stderr
164+
assert "Type mismatch for port" in result.output
165165

166166

167167
def test_validate_missing_required_value(tmp_path):
@@ -192,7 +192,7 @@ def test_validate_missing_required_value(tmp_path):
192192
["validate", "--env", "prod", "--schema", str(schema_file), "--values", str(values_file)],
193193
)
194194
assert result.exit_code == 1
195-
assert "Missing required value: database-host" in result.stderr
195+
assert "Missing required value: database-host" in result.output
196196

197197

198198
def test_validate_secret_structure(tmp_path):
@@ -226,7 +226,7 @@ def test_validate_secret_structure(tmp_path):
226226
["validate", "--env", "dev", "--schema", str(schema_file), "--values", str(values_file)],
227227
)
228228
assert result.exit_code == 1
229-
assert "Invalid secret structure for api-key" in result.stderr
229+
assert "Invalid secret structure for api-key" in result.output
230230

231231

232232
def test_validate_valid_secret(tmp_path, monkeypatch):
@@ -293,7 +293,7 @@ def test_validate_unknown_key_in_values(tmp_path):
293293
["validate", "--env", "dev", "--schema", str(schema_file), "--values", str(values_file)],
294294
)
295295
assert result.exit_code == 1
296-
assert "Unknown key: unknown-key" in result.stderr
296+
assert "Unknown key: unknown-key" in result.output
297297

298298

299299
def test_validate_shows_environment_name_in_errors(tmp_path):
@@ -333,5 +333,5 @@ def test_validate_shows_environment_name_in_errors(tmp_path):
333333
)
334334

335335
assert result.exit_code == 1
336-
assert "Missing required value: database-host" in result.stderr
337-
assert "staging" in result.stderr
336+
assert "Missing required value: database-host" in result.output
337+
assert "staging" in result.output

0 commit comments

Comments
 (0)