-
Notifications
You must be signed in to change notification settings - Fork 1.8k
return default ipc path whether it exists or not #3245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0557671
to
cb2372a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about adding a parameterized test to check the paths are correctly returned from get_default_ipc_path()
and get_dev_ipc_path()
? I think sys.platform
can be mocked to make that possible.
@@ -91,21 +91,15 @@ def get_default_ipc_path() -> Optional[str]: | |||
ipc_path = os.path.expanduser( | |||
os.path.join("~", "Library", "Ethereum", "geth.ipc") | |||
) | |||
if os.path.exists(ipc_path): | |||
return ipc_path | |||
return None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed in https://github.com/ethereum/web3.py/pull/2917/files the return None
was added to make typing work. I think we can remove the Optional
from the return type now that None
is being removed.
web3/providers/ipc.py
Outdated
@@ -91,21 +91,15 @@ def get_default_ipc_path() -> Optional[str]: | |||
ipc_path = os.path.expanduser( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Since these ipc_path
vars are not used anywhere else, just return in a single line.
ipc_path = os.path.expanduser( | |
return os.path.expanduser( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My apologies, I did not mean to approve yet. Let me know what you think about testing those functions.
316c40b
to
e9dfc9b
Compare
e9dfc9b
to
4b27874
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, nice additions! 👍
What was wrong?
Related to Issue #2911
Related to Issue #2854
How was it fixed?
Remove check to see if the
.ipc
file exists and just return the default value. Add tests.Also, the default path for
get_default_ipc_path
was fixed in #3060, but doesn't look like it was forget_dev_ipc_path
, so updated that too.Todo:
Cute Animal Picture