Skip to content

Commit f37a428

Browse files
dguidoclaude
andcommitted
fix: update ruff to latest version and apply formatting
- Update pre-commit ruff from v0.8.4 to v0.12.10 to match local version - Apply ruff format changes to test files for consistency - Fixes CI formatting failures due to version mismatch 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent ce63043 commit f37a428

File tree

4 files changed

+44
-44
lines changed

4 files changed

+44
-44
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# See https://pre-commit.com for more information
33
repos:
44
- repo: https://github.com/astral-sh/ruff-pre-commit
5-
# Ruff version should match the version in pyproject.toml
6-
rev: v0.8.4
5+
# Ruff version - using latest stable
6+
rev: v0.12.10
77
hooks:
88
# Run the linter
99
- id: ruff

tests/test_compiler_versions.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def test_solc_045(self, run_command, test_contracts_dir, backup_current_version)
3535
# Test expected compilation failure
3636
result = run_command(f"solc {test_contracts_dir}/solc045_fail_compile.sol", check=False)
3737
assert result.returncode != 0
38-
assert (
39-
"Error: Expected token Semicolon got 'Function'" in result.stdout
40-
), f"solc045_fail_compile did not fail as expected. Output: {result.stdout}"
38+
assert "Error: Expected token Semicolon got 'Function'" in result.stdout, (
39+
f"solc045_fail_compile did not fail as expected. Output: {result.stdout}"
40+
)
4141

4242
def test_solc_050(self, run_command, test_contracts_dir, backup_current_version):
4343
"""Test Solidity 0.5.0 compilation behavior."""
@@ -83,9 +83,9 @@ def test_solc_070(self, run_command, test_contracts_dir, backup_current_version)
8383
# Test deprecated 'now' keyword
8484
result = run_command(f"solc {test_contracts_dir}/solc070_fail_compile.sol", check=False)
8585
assert result.returncode != 0
86-
assert (
87-
'"now" has been deprecated.' in result.stdout
88-
), f"solc070_fail_compile did not show deprecation warning. Output: {result.stdout}"
86+
assert '"now" has been deprecated.' in result.stdout, (
87+
f"solc070_fail_compile did not show deprecation warning. Output: {result.stdout}"
88+
)
8989

9090
# Test successful compilation
9191
result = run_command(f"solc {test_contracts_dir}/solc070_success.sol", check=False)
@@ -106,16 +106,16 @@ def test_solc_080(self, run_command, test_contracts_dir, backup_current_version)
106106
result = run_command(f"solc {test_contracts_dir}/solc080_success_warning.sol", check=False)
107107
# Should succeed but with warning
108108
assert result.returncode == 0
109-
assert (
110-
"Warning: Function state mutability can be restricted to pure" in result.stdout
111-
), f"solc080_success_warning did not show expected warning. Output: {result.stdout}"
109+
assert "Warning: Function state mutability can be restricted to pure" in result.stdout, (
110+
f"solc080_success_warning did not show expected warning. Output: {result.stdout}"
111+
)
112112

113113
# Test expected compilation failure
114114
result = run_command(f"solc {test_contracts_dir}/solc080_fail_compile.sol", check=False)
115115
assert result.returncode != 0
116-
assert (
117-
"Error: Explicit type conversion not allowed" in result.stdout
118-
), f"solc080_fail_compile did not fail as expected. Output: {result.stdout}"
116+
assert "Error: Explicit type conversion not allowed" in result.stdout, (
117+
f"solc080_fail_compile did not fail as expected. Output: {result.stdout}"
118+
)
119119

120120

121121
class TestVersionSwitching:
@@ -150,9 +150,9 @@ def test_always_install_flag(self, run_command, solc_select_path, backup_current
150150
# Use with --always-install should install and switch
151151
result = run_command("solc-select use 0.8.9 --always-install", check=False)
152152
assert result.returncode == 0
153-
assert (
154-
"Switched global version to 0.8.9" in result.stdout
155-
), f"Failed to switch with --always-install. Output: {result.stdout}"
153+
assert "Switched global version to 0.8.9" in result.stdout, (
154+
f"Failed to switch with --always-install. Output: {result.stdout}"
155+
)
156156

157157
def test_use_without_install(self, run_command, solc_select_path, backup_current_version):
158158
"""Test that 'use' fails when version is not installed."""
@@ -184,9 +184,9 @@ def test_use_without_install(self, run_command, solc_select_path, backup_current
184184
# Use without install should fail
185185
result = run_command("solc-select use 0.8.1", check=False)
186186
assert result.returncode != 0
187-
assert (
188-
"'0.8.1' must be installed prior to use" in result.stdout
189-
), f"Did not fail as expected when version not installed. Output: {result.stdout}"
187+
assert "'0.8.1' must be installed prior to use" in result.stdout, (
188+
f"Did not fail as expected when version not installed. Output: {result.stdout}"
189+
)
190190

191191
# Clean up: install 0.8.1 for other tests
192192
run_command("solc-select install 0.8.1", check=False)

tests/test_platform_specific.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ def test_linux_version_boundaries(self, run_command, backup_current_version):
2424
# Test minimum version (0.4.0 on Linux)
2525
result = run_command("solc-select use 0.4.0", check=False)
2626
assert result.returncode == 0
27-
assert (
28-
"Switched global version to 0.4.0" in result.stdout
29-
), f"Failed to set minimum version. Output: {result.stdout}"
27+
assert "Switched global version to 0.4.0" in result.stdout, (
28+
f"Failed to set minimum version. Output: {result.stdout}"
29+
)
3030

3131
# Get and test latest version
3232
with urllib.request.urlopen(
@@ -37,9 +37,9 @@ def test_linux_version_boundaries(self, run_command, backup_current_version):
3737

3838
result = run_command(f"solc-select use {latest_release}", check=False)
3939
assert result.returncode == 0
40-
assert (
41-
f"Switched global version to {latest_release}" in result.stdout
42-
), f"Failed to set maximum version. Output: {result.stdout}"
40+
assert f"Switched global version to {latest_release}" in result.stdout, (
41+
f"Failed to set maximum version. Output: {result.stdout}"
42+
)
4343

4444
# Test version too low
4545
result = run_command("solc-select use 0.3.9", check=False)
@@ -69,9 +69,9 @@ def test_macos_version_boundaries(self, run_command, backup_current_version):
6969
# Test minimum version (0.3.6 on macOS)
7070
result = run_command("solc-select use 0.3.6", check=False)
7171
assert result.returncode == 0
72-
assert (
73-
"Switched global version to 0.3.6" in result.stdout
74-
), f"Failed to set minimum version. Output: {result.stdout}"
72+
assert "Switched global version to 0.3.6" in result.stdout, (
73+
f"Failed to set minimum version. Output: {result.stdout}"
74+
)
7575

7676
# Get and test latest version
7777
with urllib.request.urlopen(
@@ -82,9 +82,9 @@ def test_macos_version_boundaries(self, run_command, backup_current_version):
8282

8383
result = run_command(f"solc-select use {latest_release}", check=False)
8484
assert result.returncode == 0
85-
assert (
86-
f"Switched global version to {latest_release}" in result.stdout
87-
), f"Failed to set maximum version. Output: {result.stdout}"
85+
assert f"Switched global version to {latest_release}" in result.stdout, (
86+
f"Failed to set maximum version. Output: {result.stdout}"
87+
)
8888

8989
# Test version too low
9090
result = run_command("solc-select use 0.3.5", check=False)
@@ -114,9 +114,9 @@ def test_windows_version_boundaries(self, run_command, backup_current_version):
114114
# Test minimum version (0.4.5 on Windows, matching original bash test)
115115
result = run_command("solc-select use 0.4.5", check=False)
116116
assert result.returncode == 0
117-
assert (
118-
"Switched global version to 0.4.5" in result.stdout
119-
), f"Failed to set minimum version. Output: {result.stdout}"
117+
assert "Switched global version to 0.4.5" in result.stdout, (
118+
f"Failed to set minimum version. Output: {result.stdout}"
119+
)
120120

121121
# Get and test latest version
122122
with urllib.request.urlopen(
@@ -127,9 +127,9 @@ def test_windows_version_boundaries(self, run_command, backup_current_version):
127127

128128
result = run_command(f"solc-select use {latest_release}", check=False)
129129
assert result.returncode == 0
130-
assert (
131-
f"Switched global version to {latest_release}" in result.stdout
132-
), f"Failed to set maximum version. Output: {result.stdout}"
130+
assert f"Switched global version to {latest_release}" in result.stdout, (
131+
f"Failed to set maximum version. Output: {result.stdout}"
132+
)
133133

134134
# Test version too low (matching original bash test: 0.3.9)
135135
result = run_command("solc-select use 0.3.9", check=False)

tests/test_upgrade.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ def test_upgrade_preserves_versions(self, run_command, tmp_path): # pylint: dis
6262
new_versions = sorted(result.stdout.strip().split("\n"))
6363

6464
# Verify solc version wasn't changed
65-
assert (
66-
old_solc_version == new_solc_version
67-
), f"solc version changed during upgrade: {old_solc_version} -> {new_solc_version}"
65+
assert old_solc_version == new_solc_version, (
66+
f"solc version changed during upgrade: {old_solc_version} -> {new_solc_version}"
67+
)
6868

6969
# Verify all versions are still installed
70-
assert (
71-
old_versions == new_versions
72-
), f"Installed versions changed during upgrade.\nOld: {old_versions}\nNew: {new_versions}"
70+
assert old_versions == new_versions, (
71+
f"Installed versions changed during upgrade.\nOld: {old_versions}\nNew: {new_versions}"
72+
)
7373

7474
finally:
7575
# Ensure development version is reinstalled for other tests

0 commit comments

Comments
 (0)