Skip to content

Commit

Permalink
fix: problem
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Sep 9, 2024
1 parent a6e99e5 commit bb6d6c6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ape_solidity/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ def _resolve_source(
self._resolve_path(reference, project)

def _resolve_import_remapping(self, project: ProjectManager):
if self.value.startswith("."):
# Relative paths should not use import-remappings.
return

import_remapping = self.solidity._import_remapping_cache[project]

# Get all matches.
Expand Down
11 changes: 11 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
return true;
}
}
// File: ./safe/ThisIsNotGnosisSafe.sol
// The point of this file is show we can have contracts in folders
// where the folder is the same name as a dependency.
contract ThisIsNotGnosisSafe {
constructor(){
}
}
// File: ./subfolder/Relativecontract.sol
contract Relativecontract {
Expand Down Expand Up @@ -138,6 +147,8 @@
// Purposely repeat an import to test how the plugin handles that.
// Show we can import a local contract with the same name (sin-@) as a dependency.
// Purposely exclude the contracts folder to test older Ape-style project imports.
// Showing sources with extra extensions are by default excluded,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def test_get_imports_complex(project, compiler):
"contracts/MissingPragma.sol",
"contracts/NumerousDefinitions.sol",
"contracts/Source.extra.ext.sol",
"contracts/safe/ThisIsNotGnosisSafe.sol",
"contracts/subfolder/Relativecontract.sol",
],
"contracts/MissingPragma.sol": [],
Expand Down Expand Up @@ -413,6 +414,7 @@ def test_get_compiler_settings(project, compiler):
"contracts/MissingPragma.sol",
"contracts/NumerousDefinitions.sol",
"contracts/Source.extra.ext.sol",
"contracts/safe/ThisIsNotGnosisSafe.sol",
"contracts/subfolder/Relativecontract.sol",
]
assert actual_files == expected_files
Expand Down

0 comments on commit bb6d6c6

Please sign in to comment.