Skip to content

Commit 7444c23

Browse files
Minor formatting and test fixes
1 parent 9eace4a commit 7444c23

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

shared/python/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def create_infrastructure(self, bypass_infrastructure_check: bool = False, allow
212212

213213
return True
214214

215-
except (KeyboardInterrupt, EOFError) as exc: # pragma: no cover
215+
except (KeyboardInterrupt, EOFError): # pragma: no cover
216216
print_error('\nInfrastructure deployment cancelled by user.')
217217
return False
218218
except Exception as e: # pragma: no cover
@@ -810,7 +810,7 @@ def does_infrastructure_exist(infrastructure: INFRASTRUCTURE, index: int, allow_
810810

811811
if choice == '1':
812812
return False # Allow deployment to proceed
813-
elif choice == '2' or choice == '3':
813+
elif choice in ('2', '3'):
814814
return True # Block deployment
815815
elif not choice:
816816
# Empty input (ESC pressed in Jupyter) - cancel

tests/python/check_python.ps1

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ Write-Host "╚═════════════════════
153153
Write-Host ""
154154

155155
# Determine statuses
156-
$LintStatus = if ($LintExitCode -eq 0) { "✅ PASSED" } else { "⚠️ ISSUES FOUND" }
156+
$LintStatus = if ($LintExitCode -eq 0) { "✅ PASSED" } else { "⚠️ ISSUES FOUND" } # leave two spaces after yellow triangle to display correctly
157157
$TestStatus = if ($FailedTests -eq 0) { "✅ PASSED" } else { "❌ FAILED" }
158158

159159
# Get pylint score
@@ -168,11 +168,7 @@ if (Test-Path $LatestPylintText) {
168168

169169
# Set colors
170170
$LintColor = if ($LintExitCode -eq 0) { "Green" } else { "Yellow" }
171-
$TestColor = if ($TestExitCode -eq 0) { "Green" } else { "Red" }
172-
173-
# Calculate column widths for alignment
174-
$LabelWidth = "Pylint :".Length # 7
175-
$Padding = " " * ($LabelWidth - 1)
171+
$TestColor = if ($FailedTests -eq 0) { "Green" } else { "Red" }
176172

177173
# Display Pylint status with score
178174
Write-Host "Pylint : " -NoNewline

tests/python/check_python.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ echo ""
116116
if [ $LINT_EXIT_CODE -eq 0 ]; then
117117
LINT_STATUS="✅ PASSED"
118118
else
119-
LINT_STATUS="⚠️ ISSUES FOUND"
119+
LINT_STATUS="⚠️ ISSUES FOUND" # leave two spaces after yellow triangle to display correctly
120120
fi
121121

122122
# Determine Test status
@@ -132,7 +132,11 @@ if [ -n "$PYLINT_SCORE" ]; then
132132
echo " ($PYLINT_SCORE)"
133133
fi
134134

135-
echo "Tests : $TEST_STATUS"
135+
if [ $FAILED_TESTS -eq 0 ]; then
136+
echo "Tests : $TEST_STATUS"
137+
else
138+
echo -e "Tests : \e[31m$TEST_STATUS\e[0m" # Red color for failed tests
139+
fi
136140
if [ $TOTAL_TESTS -gt 0 ]; then
137141
# Calculate percentages (using bc for floating point)
138142
PASSED_PERCENT=$(echo "scale=2; $PASSED_TESTS / $TOTAL_TESTS * 100" | bc)

tests/python/test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -993,8 +993,8 @@ def test_prompt_for_infrastructure_update_option_1(monkeypatch):
993993
assert result == (True, None)
994994

995995
def test_prompt_for_infrastructure_update_option_1_default(monkeypatch):
996-
"""Test _prompt_for_infrastructure_update when user presses Enter (defaults to option 1)."""
997-
monkeypatch.setattr('builtins.input', lambda prompt: '')
996+
"""Test _prompt_for_infrastructure_update when user selects option 1 explicitly."""
997+
monkeypatch.setattr('builtins.input', lambda prompt: '1')
998998

999999
result = utils._prompt_for_infrastructure_update('test-rg')
10001000
assert result == (True, None)

0 commit comments

Comments
 (0)