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

Bump python version to 3.6, fix tests for redis timeout, fix up travis/coveralls reporting #1

Merged
merged 6 commits into from
Nov 24, 2017

Conversation

brew
Copy link
Contributor

@brew brew commented Nov 24, 2017

This PR bumps the python version to 3.6 and fixes tests to reflect RedisCache timeout behaviour.

This PR is part of openspending/openspending#1302

RedisCache timeout for expiring items can be set either during creation of the cache, with a default_timeout, or when putting an item into the cache, with a timeout parameter.

  • If no timeout is provided using the put, default_timeout will be used.
    self._put(context, params, pickled, self.timeout(timeout))

    def timeout(self, _timeout=None):
    if _timeout is not None:
    return _timeout
    return self._default_timeout
  • If an item is accessed, default_timeout will be reset on it.
    self.redis_connection.expire(key, self.timeout())
    self.redis_connection.expire(context_key, self.timeout())
  • If a timeout value is provided during the put, the item will be set to expire after that time. However, if it accessed within that time, a new expire timeout is set to the default_timeout value.

Add tests/__init__.py to coverage works, and add coverage to
.travis.yml.
RedisCache timeout for expiring keys can be set with a default_timeout
during cache creation, or (for first access) with a timeout when putting
the item. After first access the default_timeout is reset.
tox.ini Outdated
envlist=
py35
py36
skip_missing_interpreters = true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same small tweak, no point skipping missing interpreters if you just have one. However, it doesn't matter much anyway.

@brew brew merged commit 7da39c7 into master Nov 24, 2017
@vitorbaptista vitorbaptista deleted the version-bump branch November 24, 2017 13:33
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.

None yet

2 participants