Skip to content

Commit

Permalink
add retry on JSONDecodeError. fix issue #105 (#106)
Browse files Browse the repository at this point in the history
* add retry on JSONDecodeError

* remove support in python 3.4

* remove traces of python 3.4 in tox

* remove traces of python 3.4 in tox
  • Loading branch information
gs202 authored and lukas-bednar committed Sep 9, 2019
1 parent 79cd007 commit 8123759
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 29 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: python
python:
- "3.4"
- "3.5"
- "3.6"
matrix:
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ Requires
- pytest >= 2.2.3
- requests >= 2.13.0
- six
- retry>=0.9.2

Installation
============
Expand Down
5 changes: 4 additions & 1 deletion pytest_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
import os
import re
import sys
from distutils.version import LooseVersion
from json import JSONDecodeError

import pytest
import requests
import six
from distutils.version import LooseVersion
from retry import retry

DEFAULT_RESOLVE_STATUSES = 'closed', 'resolved'
DEFAULT_RUN_TEST_CASE = True
Expand Down Expand Up @@ -214,6 +216,7 @@ def check_connection(self):
self.is_connected = True
return True

@retry(JSONDecodeError, tries=3, delay=2)
def get_issue(self, issue_id):
if not self.is_connected:
self.check_connection()
Expand Down
3 changes: 0 additions & 3 deletions requirements-pytest2.txt

This file was deleted.

3 changes: 0 additions & 3 deletions requirements-pytest3.txt

This file was deleted.

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pytest>=2.2.4
six
requests>=2.13.0
retry>=0.9.2
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ classifier=
Operating System :: POSIX
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Expand Down
21 changes: 1 addition & 20 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tox]
envlist = py34-pytest2,py34-pytest3,py34,py35,py36,py37,pep8
envlist = py35,py36,py37,pep8
[tox:travis]
3.4 = py34, pep8, py34-pytest2, py34-pytest3
3.5 = py35, pep8
3.6 = py36, pep8
3.7 = py37, pep8
Expand All @@ -17,21 +16,3 @@ commands=
coverage report
[testenv:pep8]
commands=flake8 setup.py pytest_jira.py tests
[testenv:py34-pytest2]
deps=
-rtests/requirements.txt
-rrequirements-pytest2.txt
setenv =
PYTEST_ADDOPTS=-p pytester --basetemp={envtmpdir}
commands=
coverage run --source pytest_jira -m py.test
coverage report
[testenv:py34-pytest3]
deps=
-rtests/requirements.txt
-rrequirements-pytest3.txt
setenv =
PYTEST_ADDOPTS=-p pytester --basetemp={envtmpdir}
commands=
coverage run --source pytest_jira -m py.test
coverage report

0 comments on commit 8123759

Please sign in to comment.