Skip to content

Commit

Permalink
fix: more fix from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Nov 27, 2024
1 parent 0df58ac commit 5e02001
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/ape_console/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ def import_extras_file(file_path) -> ModuleType:
class ApeConsoleNamespace(dict):
def __init__(self, **kwargs):
# Initialize the dictionary with provided keyword arguments
project = kwargs.get("project", self._ape.project)
kwargs["project"] = self._ape.Project(project) if isinstance(project, Path) else project
super().__init__(**kwargs)

def __getitem__(self, key: str):
Expand Down Expand Up @@ -115,11 +117,11 @@ def _ape(self) -> ModuleType:

@cached_property
def _local_path(self) -> Path:
return self._ape.project.path.joinpath(CONSOLE_EXTRAS_FILENAME)
return self["project"].path.joinpath(CONSOLE_EXTRAS_FILENAME)

@cached_property
def _global_path(self) -> Path:
return self._ape.project.config_manager.DATA_FOLDER.joinpath(CONSOLE_EXTRAS_FILENAME)
return self._ape.config.DATA_FOLDER.joinpath(CONSOLE_EXTRAS_FILENAME)

@cached_property
def _local_extras(self) -> dict:
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,8 @@ def test_networks_when_custom_ecosystem(

def test_networks_multiple_networks_with_same_name(custom_networks_config_dict, ethereum, project):
data = copy.deepcopy(custom_networks_config_dict)
data["networks"]["custom"][0]["name"] = "foonet" # There already is a foonet in "ethereum".
data["networks"]["custom"][1]["name"] = "foonet" # There already is a foonet in "ethereum".
data["networks"]["custom"][0]["name"] = "foonet"
data["networks"]["custom"][1]["name"] = "foonet"
expected = ".*More than one network named 'foonet' in ecosystem 'ethereum'.*"
with project.temp_config(**data):
with pytest.raises(NetworkError, match=expected):
Expand Down

0 comments on commit 5e02001

Please sign in to comment.