Skip to content
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

Fix ftp test_ls_root_dircache() #1644

Merged
merged 1 commit into from
Jul 2, 2024
Merged

Conversation

Astropilot
Copy link
Contributor

Oops, following the tests results for #1643 I noticed this warning:

fsspec/implementations/tests/test_ftp.py::test_ls_root_dircache
  /home/runner/micromamba/envs/test_env/lib/python3.8/site-packages/_pytest/unraisableexception.py:80: PytestUnraisableExceptionWarning: Exception ignored in: <function FTPFileSystem.__del__ at 0x7fee3a7bb9d0>
  
  Traceback (most recent call last):
    File "/home/runner/work/filesystem_spec/filesystem_spec/fsspec/implementations/ftp.py", line 251, in __del__
      self.ftp.close()
  AttributeError: 'NoneType' object has no attribute 'close'
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

I was not aware (but it makes sense) of the closing connection with the __del__ method.
Fixed it by restoring the ftp variable after test usage.

…usage to prevent raised exception in __del__
@martindurant
Copy link
Member

OK :).

@martindurant martindurant merged commit 1e2591c into fsspec:master Jul 2, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants