Open ibnesayeed opened 4 years ago
I am able to replicate a very long delay on a Windows 10 VM. Using latest master (4fca791):
For this, I am running the ipfs daemon separate (v0.6.0).
If I do not start the daemon separately and just run py -m pytest ./
:
if socket_options is not None: for opt in socket_options: sock.setsockopt(*opt) if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT: sock.settimeout(timeout) if source_address: sock.bind(source_address) sock.connect(sa) return sock except OSError as e: err = e if sock is not None: sock.close() sock = None if err is not None: > raise err ..\..\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ipfshttpclient\requests_wrapper.py:66: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ address = ('localhost', 5001), timeout =
It might be good to start the daemon and run the tests individually to isolate the problem.
Dropping to the debugger on the first failure might be informative, e.g. (view raw),
> pytest -x --pdb ================================================= test session starts ================================================= platform win32 -- Python 3.8.3, pytest-5.4.3, py-1.9.0, pluggy-0.13.1 rootdir: C:\Users\mrk335\Desktop\ipwb-master, inifile: setup.cfg plugins: cov-2.10.0, flake8-1.0.6 collected 114 items tests\test_backends.py F >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> def test_local(): > assert get_web_archive_index(SAMPLE_INDEX).startswith( '!context ["http://tools.ietf.org/html/rfc7089"]' ) tests\test_backends.py:16: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ipwb\backends.py:87: in get_web_archive_index response = fetch_web_index(path) ipwb\backends.py:53: in fetch_web_index return requests.get(path).text ..\..\appdata\local\programs\python\python38-32\lib\site-packages\requests\api.py:76: in get return request('get', url, params=params, **kwargs) ..\..\appdata\local\programs\python\python38-32\lib\site-packages\requests\api.py:61: in request return session.request(method=method, url=url, **kwargs) ..\..\appdata\local\programs\python\python38-32\lib\site-packages\requests\sessions.py:530: in request resp = self.send(prep, **send_kwargs) ..\..\appdata\local\programs\python\python38-32\lib\site-packages\requests\sessions.py:637: in send adapter = self.get_adapter(url=request.url) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self =url = 'C:\\Users\\mrk335\\Desktop\\ipwb-master\\samples\\indexes\\salam-home.cdxj' def get_adapter(self, url): """ Returns the appropriate connection adapter for the given URL. :rtype: requests.adapters.BaseAdapter """ for (prefix, adapter) in self.adapters.items(): if url.lower().startswith(prefix.lower()): return adapter # Nothing matches :-/ > raise InvalidSchema("No connection adapters were found for {!r}".format(url)) E requests.exceptions.InvalidSchema: No connection adapters were found for 'C:\\Users\\mrk335\\Desktop\\ipwb-master\\samples\\indexes\\salam-home.cdxj' ..\..\appdata\local\programs\python\python38-32\lib\site-packages\requests\sessions.py:730: InvalidSchema >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> > c:\users\mrk335\appdata\local\programs\python\python38-32\lib\site-packages\requests\sessions.py(730)get_adapter() -> raise InvalidSchema("No connection adapters were found for {!r}".format(url))
Failing test:
def test_local():
assert get_web_archive_index(SAMPLE_INDEX).startswith(
'!context ["http://tools.ietf.org/html/rfc7089"]'
)
Perhaps it is trying to read the whole string as a URI and indicating what it is parsing as the scheme (!content
) as invalid.
I presume testing "local" means passing the function a string and seeing how it behaves, which might be indicative of the test rightly failing because of the questionable support for this in backends.py.
EDIT: still odd that this passes on non-Windows OSes (e.g., macOS, unable to replicate).
get_web_archive_index()
handles an index define by 1: IPFS Multihash address, 2: web URI, 3. local file/path but does not interpret the string !context ["http://tools.ietf.org/html/rfc7089"]
. Further testing is needed to determine which code path !context ["http://tools.ietf.org/html/rfc7089"]
is taking from these three ordered options.
Update: It's path 1, the call to fetch_ipfs_index()
, so on macOS, !context ["http://tools.ietf.org/html/rfc7089"] is treated as a successful multihash but on Windows, it fails.
@machawk1 do you think fixing #687 might improve the situation here?
It might help, @ibnesayeed, but I am curious as to why it is considered a hash on macOS but not Windows. This might also point to a bug in py-ipfs-http-client. I am hoping to investigate further.
@machawk1 did you try to investigate these issues on atomic level in the interactive Python prompt in Windows?
@ibnesayeed What I tried is documented above. More to come.
During the recent implementation of GH Workflow CI #648 for cross-platform matrix testing we found that tests were failing on Windows and hanging the process indefinitely. Once such failed attempts can be seen in a previous CI log (expand the skipped "Run Tests" step for details). This shows some exceptions there, which need to be investigated on a Windows machine manually.
The possibility of the failure coming from the newly created IPFS Setup Action unlikely because tests there are passing in all platforms, both for CLI and API.