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

get_cached_default_environment: cache by VIRTUAL_ENV only #1201

Closed

Conversation

blueyed
Copy link
Contributor

@blueyed blueyed commented Aug 14, 2018

Fixes #1200

@codecov-io
Copy link

Codecov Report

Merging #1201 into master will decrease coverage by 0.23%.
The diff coverage is 87.5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1201      +/-   ##
==========================================
- Coverage   92.86%   92.62%   -0.24%     
==========================================
  Files          57       57              
  Lines        6910     6916       +6     
==========================================
- Hits         6417     6406      -11     
- Misses        493      510      +17
Impacted Files Coverage Δ
jedi/api/environment.py 81.72% <87.5%> (+0.05%) ⬆️
jedi/cache.py 71.23% <0%> (-21.92%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6306a0...5f59f7d. Read the comment docs.

@davidhalter
Copy link
Owner

What I meant to say in #1200 was this:

def get_cached_default_environment():
    environment = _get_cached_default_environment()
    if environment.prefix != <virtualenv_variable>:
        _get_cached_default_environment.reset()
        return _get_cached_default_environment()
    return environment

# Rename 
@time_cache(seconds=10 * 60)
def _get_cached_default_environment():
    return get_default_environment()

Obviously you would also need to add the reset function for time_cache. It doesn't exist, yet.

@davidhalter
Copy link
Owner

I changed it now in a bit of a different way, but thanks still for your initial thoughts!

@blueyed blueyed deleted the get_cached_default_environment branch September 30, 2018 17:47
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.

3 participants