Skip to content

Commit

Permalink
Updated for new flake8
Browse files Browse the repository at this point in the history
Added retrying dev requirement and use in memcache tests.
  • Loading branch information
pkittenis committed Nov 3, 2018
1 parent 60ce422 commit 9a4fed5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
before_install: skip
install: skip
script: skip
after_success: skip
deploy:
provider: pypi
on:
Expand All @@ -67,18 +68,15 @@ jobs:
skip_upload_docs: true
after_deploy:
- docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" &&
cd docker &&
docker build --pull -t ikuosu/influxgraph:${TRAVIS_TAG} . &&
docker build --pull -t ikuosu/influxgraph:${TRAVIS_TAG} docker &&
docker push influxgraph/influxgraph:${TRAVIS_TAG};
before_install:
- pip install -U pip setuptools wheel
- wget https://dl.influxdata.com/influxdb/releases/influxdb_${INFLUXDB_VERSION}_amd64.deb
- sudo dpkg -i influxdb_${INFLUXDB_VERSION}_amd64.deb
- sudo /etc/init.d/influxdb start
install:
- pip install -r requirements.txt
- pip install coverage codecov flake8
- python setup.py build_ext --inplace
- pip install -r requirements_dev.txt
script:
- nosetests --with-coverage --cover-package=influxgraph
- nosetests --with-coverage --cover-package=influxgraph tests/test_influxdb_integration.py
Expand All @@ -88,10 +86,9 @@ script:
- flake8 influxgraph
after_success:
- codecov
- docker build --pull -t ikuosu/influxgraph:latest docker
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" &&
cd docker &&
docker build --pull -t ikuosu/influxgraph:latest . &&
docker push influxgraph/influxgraph:latest;
fi

Expand Down
5 changes: 2 additions & 3 deletions influxgraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

from __future__ import absolute_import, print_function

import logging
from .classes.finder import InfluxDBFinder as InfluxDBFinder # flake8: noqa
from .classes.reader import InfluxDBReader as InfluxDBReader # flake8: noqa
from .classes.finder import InfluxDBFinder as InfluxDBFinder # noqa
from .classes.reader import InfluxDBReader as InfluxDBReader # noqa

from ._version import get_versions
__version__ = get_versions()['version']
Expand Down
3 changes: 2 additions & 1 deletion influxgraph/classes/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,8 @@ def build_index(self, data=None, separator=b'.'):

def _save_index_file(self, file_h):
"""Dump tree contents to file handle"""
json.dump(self.index.to_array(), file_h)
if self.index:
json.dump(self.index.to_array(), file_h)

def save_index(self):
"""Save index to file"""
Expand Down
2 changes: 2 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
coverage
codecov
flake8
nose
retrying
-e .
5 changes: 4 additions & 1 deletion tests/test_influxdb_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from random import randint
import logging
import fcntl
from retrying import retry

from influxdb import InfluxDBClient
import influxdb.exceptions
Expand Down Expand Up @@ -319,6 +320,7 @@ def test_single_fetch_data(self):
msg="Expected %s datapoints - got %s" % (
self.num_datapoints, len(datapoints),))

@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
def test_single_fetch_memcache_integration(self):
self.config['influxdb']['memcache'] = {'host': 'localhost'}
del self.config['search_index']
Expand Down Expand Up @@ -514,8 +516,8 @@ def test_get_series_pagination(self):
msg="Did not get data for all series with page limit %s" % (
limit,))

@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
def test_memcache_integration(self):
del self.finder
config = { 'influxdb' : { 'host' : 'localhost',
'port' : 8086,
'user' : 'root',
Expand Down Expand Up @@ -605,6 +607,7 @@ def test_memcache_integration(self):
self.assertTrue(fake_nodes[0].path in data)
self.assertFalse(finder.memcache.get(fake_nodes_memcache_key))

@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
def test_reader_memcache_integration(self):
reader = influxgraph.InfluxDBReader(
InfluxDBClient(database=self.db_name),
Expand Down

0 comments on commit 9a4fed5

Please sign in to comment.