-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
read_fwf with urlopen test GH#26376 #52233
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
|
||
def test_url_urlopen(): | ||
url = "ftp://ftp.ncdc.noaa.gov/pub/data/igra/igra2-station-list.txt" | ||
f = urlopen(url) |
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.
Can you use this as a context manager?
6dc5937
to
6e4478e
Compare
If I added
It seems like a bug in the tm codes? |
def test_url_urlopen(): | ||
url = "ftp://ftp.ncdc.noaa.gov/pub/data/igra/igra2-station-list.txt" | ||
with urlopen(url) as f: | ||
expected = pd.Index( |
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.
Can you put this outside the context manager?
|
||
@pytest.mark.network | ||
@tm.network( | ||
url=("ftp://ftp.ncdc.noaa.gov/pub/data/igra/igra2-station-list.txt"), |
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.
url=("ftp://ftp.ncdc.noaa.gov/pub/data/igra/igra2-station-list.txt"), | |
url="ftp://ftp.ncdc.noaa.gov/pub/data/igra/igra2-station-list.txt", |
Could you diagnose how to check if ftp urls are connectable? |
Signed-off-by: Liang Yan <ckgppl_yan@sina.cn>
I done some diagnosis. url open with ftp will return a urllib.response.addinfourl instance. There is a status method of addinfourl, but from python 3.9 only. And I have tried using python 3.10, the status only return None. It seems that if the ftp url can be open, then it is also connectable. So I added codes in can_connect to only check http/https url status. |
Thanks for the test and nice investigation @liang3zy22 |
To avoid download file, I just compare the columns.