Skip to content

Commit

Permalink
fix: show file name instead of attr in missing source error message (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored May 1, 2024
1 parent 003a8e3 commit fe44b78
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ape/managers/project/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ def _handle_attr_or_contract_not_found(self, attr_name: str):
continue

message = (
f"{message} However, there is a source file named '{attr_name}', "
f"{message} However, there is a source file named '{file.name}', "
"did you mean to reference a contract name from this source file?"
)
file_check_appended = True
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_missing_compilers_error_message(project_with_source_files_contract, sen
missing_exts = project_with_source_files_contract.extensions_with_missing_compilers()
expected = (
r"ProjectManager has no attribute or contract named 'ContractA'\. "
r"However, there is a source file named 'ContractA', "
r"However, there is a source file named 'ContractA.sol', "
r"did you mean to reference a contract name from this source file\? "
r"Else, could it be from one of the missing compilers for extensions: "
rf'{", ".join(sorted(missing_exts))}\?'
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def test_getattr_contract_not_exists(project):
expected = (
r"ProjectManager has no attribute or contract named "
r"'ThisIsNotAContractThatExists'. However, there is a source "
r"file named 'ThisIsNotAContractThatExists', did you mean to "
r"file named 'ThisIsNotAContractThatExists\.foo', did you mean to "
r"reference a contract name from this source file\? "
r"Else, could it be from one of the missing compilers for extensions:.*\?"
)
Expand Down

0 comments on commit fe44b78

Please sign in to comment.