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

Add "pyfakefs" to testing dependencies #11463

Closed
3 tasks done
travishathaway opened this issue May 10, 2022 · 2 comments
Closed
3 tasks done

Add "pyfakefs" to testing dependencies #11463

travishathaway opened this issue May 10, 2022 · 2 comments
Labels
locked [bot] locked due to inactivity source::anaconda created by members of Anaconda, Inc. type::feature request for a new feature or capability

Comments

@travishathaway
Copy link
Contributor

Checklist

  • I added a descriptive title
  • I searched for other feature requests and couldn't find a duplicate (including also the type-feature tag)
  • I confirmed that it's not related to another project (see the above section)

What is the idea?

I would like to have "pyfakefs" added to this project's testing dependencies.

Why is this needed

While writing tests, it is often very useful to have a "virtual" file system. pyfakefs enables this with a nice API exposing virtual file systems as a testing fixture.

This PR has an example of how I intend to use this library:

What should happen?

pyfakefs should be added to the projects testing dependencies.

Additional Context

No response

@travishathaway travishathaway added type::feature request for a new feature or capability source::anaconda created by members of Anaconda, Inc. labels May 10, 2022
@jezdez
Copy link
Member

jezdez commented May 10, 2022

My worries around adding this as a runtime dependency come from not knowing if it's practical to rely on, from http://jmcgeheeiv.github.io/pyfakefs/release/usage.html#modules-not-working-with-pyfakefs:

A list of Python modules that are known to not work correctly with pyfakefs will be collected here: multiprocessing, subprocess, ...

An alternative would be to use fsspec's memory backend and use it to write new tests. The upside is that given its features we can access the local file system if a test requires it (or even wrap consecutive calls in a cache) without additional overhead of maintenance or change of interface.

A memory backend fsspec pytest fixture is defined in its own tests here and used here. It's also available on the defaults channel already.

@travishathaway
Copy link
Contributor Author

Thanks for the feedback on this. I am going to adjust currently open PRs accordingly.

@beeankha beeankha added the backlog issue has been triaged but has not been earmarked for any upcoming release label May 10, 2022
@travishathaway travishathaway removed the backlog issue has been triaged but has not been earmarked for any upcoming release label May 11, 2022
@github-actions github-actions bot added the locked [bot] locked due to inactivity label May 12, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity source::anaconda created by members of Anaconda, Inc. type::feature request for a new feature or capability
Projects
None yet
Development

No branches or pull requests

3 participants