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

memestra tests are sensitive to global mutable state #61

Open
cpcloud opened this issue Jul 23, 2021 · 5 comments · May be fixed by #63
Open

memestra tests are sensitive to global mutable state #61

cpcloud opened this issue Jul 23, 2021 · 5 comments · May be fixed by #63

Comments

@cpcloud
Copy link

cpcloud commented Jul 23, 2021

When running tests for pythons 3.8 and 3.9 after running tests for python 3.7 without the necessary changes to gast and beniget, both to support NamedExprs, the tests pass. With a clean cache (rm -rf $XDG_CONFIG_HOME/memestra) the tests fail as they ought to. Whatever is being stored in $XDG_CONFIG_HOME isn't taking into account enough information to make the behavior of the tool the same as it would be without a cache.

@cpcloud
Copy link
Author

cpcloud commented Jul 23, 2021

To reproduce:

  1. Run tests with python 3.7
  2. Run tests with python 3.8. This should fail, but it doesn't

@cpcloud
Copy link
Author

cpcloud commented Jul 23, 2021

Maybe a dumb question, but is the cache actually necessary? It seems like if it's causing incorrect behavior then it might be reasonable to take the performance hit until there's enough testing in place to ensure that the introduction of an optimization like a cache doesn't break things.

@serge-sans-paille
Copy link
Collaborator

The cache is important, because it caches the transversal of the standard library, which is used by most modules.
I need to dive into this some more...

@cpcloud
Copy link
Author

cpcloud commented Jul 24, 2021

The cache needs to be isolated to the running interpreter though, not shared by any python interpreter that comes along. What about using a location for the cache that is tied to the running interpreter, instead of a system-wide cache?

@cpcloud
Copy link
Author

cpcloud commented Jul 24, 2021

One way to do this would be to create a directory under $XDG_CONFIG_HOME/memestra/usr/bin/python3 for example. Conda environments, nix store paths, virtualenvs etc would all be isolated from each other under this scheme.

serge-sans-paille added a commit that referenced this issue Aug 6, 2021
This prevents subtle issues when the ast changes but gast / beniget / memestra
don't get updated accordingly.

Fix #61
@serge-sans-paille serge-sans-paille linked a pull request Aug 6, 2021 that will close this issue
serge-sans-paille added a commit that referenced this issue Aug 6, 2021
This prevents subtle issues when the ast changes but gast / beniget / memestra
don't get updated accordingly.

Fix #61
serge-sans-paille added a commit that referenced this issue Aug 6, 2021
This prevents subtle issues when the ast changes but gast / beniget / memestra
don't get updated accordingly.

Fix #61
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 a pull request may close this issue.

2 participants