Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/cli/gentest/source_code_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,24 @@ def format_code(code: str) -> str:
# Create a Path object for the input file
input_file_path = Path(temp_file.name)

# Get the path to the black executable in the virtual environment
# Get the path to the formatter executable in the virtual environment
if sys.platform.startswith("win"):
black_path = Path(sys.prefix) / "Scripts" / "black.exe"
formatter_path = Path(sys.prefix) / "Scripts" / "ruff.exe"
else:
black_path = Path(sys.prefix) / "bin" / "black"
formatter_path = Path(sys.prefix) / "bin" / "ruff"

# Call black to format the file
# Call ruff to format the file
config_path = Path(sys.prefix).parent / "pyproject.toml"

subprocess.run(
[str(black_path), str(input_file_path), "--quiet", "--config", str(config_path)],
[
str(formatter_path),
"format",
str(input_file_path),
"--quiet",
"--config",
str(config_path),
],
check=True,
)

Expand Down
4 changes: 2 additions & 2 deletions src/cli/gentest/templates/blockchain_test/transaction.py.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Gentest autogenerated test from `tx.hash`:
{{ tx_hash }}
https://etherscan.io/tx/{{tx_hash}}
https://etherscan.io/tx/{{tx_hash}}.
"""

from typing import Dict
Expand All @@ -25,7 +25,7 @@ def test_transaction_{{ tx_hash }}(
):
"""
Gentest autogenerated test for tx.hash:
{{ tx_hash }}
{{ tx_hash }}.
"""
pre = {{ pre_state | stringify }}

Expand Down