Skip to content

Commit

Permalink
GitHub actions setup + tox configuration (#62)
Browse files Browse the repository at this point in the history
Drop support for py2.7 and py3.5.
  • Loading branch information
danielfm authored Mar 2, 2022
1 parent 1679101 commit 56b7729
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 28 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: pybreaker test matrix

on:
push:
branches: [main]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.6"
- python-version: "3.7"
- python-version: "3.8"
- python-version: "3.9"
- python-version: "3.10"
steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Upgrade pip version
run: |
python -m pip install -U pip
- name: Install wheel
run: |
python -m pip install wheel
- name: Python versions
run: |
echo "Python ${{ matrix.python-version }}"
python --version
- name: Run tests
run: |
python setup.py test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Compiled python code
*.pyc

# tox
.tox

# Build directories
build/
dist/
Expand Down
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

7 changes: 6 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Changelog
=========

Version 0.7.0 (December 14, 2021)
Version 0.8.0 (December 14, 2021)

* Add support to redis cluster storage, without ttransaction on opened... (Thanks @felipeagger)
* Replace Travis by GitHub Actions workflow

Version 0.7.0 (March 3, 2022)

* Option for throwing original error on circuit trip (Thanks @Cruuncher)

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Features
Requirements
------------

* `Python`_ 3.4+
* `Python`_ 3.6+


Installation
Expand Down
12 changes: 7 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='pybreaker',
version='0.7.0',
version='0.8.0',
description='Python implementation of the Circuit Breaker pattern',
long_description=open('README.rst', 'r').read(),
keywords=['design', 'pattern', 'circuit', 'breaker', 'integration'],
Expand All @@ -26,11 +26,13 @@
url='http://github.com/danielfm/pybreaker',
package_dir={'': 'src'},
py_modules=['pybreaker'],
install_requires=[
'six',
],
include_package_data=True,
zip_safe=False,
test_suite='tests',
tests_require=['mock', 'fakeredis==0.16.0', 'redis==2.10.6', 'tornado'],
tests_require=[
'mock',
'fakeredis==0.16.0',
'redis==2.10.6',
'tornado'
],
)
5 changes: 2 additions & 3 deletions src/pybreaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from datetime import datetime, timedelta
from functools import wraps
import threading
import six
import sys

try:
Expand Down Expand Up @@ -821,7 +820,7 @@ def on_failure(self, exc):

if throw_new_error:
error_msg = 'Failures threshold reached, circuit breaker opened'
six.reraise(CircuitBreakerError, CircuitBreakerError(error_msg), sys.exc_info()[2])
raise CircuitBreakerError(error_msg).with_traceback(sys.exc_info()[2])
else:
raise exc

Expand Down Expand Up @@ -895,7 +894,7 @@ def on_failure(self, exc):

if throw_new_error:
error_msg = 'Trial call failed, circuit breaker opened'
six.reraise(CircuitBreakerError, CircuitBreakerError(error_msg), sys.exc_info()[2])
raise CircuitBreakerError(error_msg).with_traceback(sys.exc_info()[2])
else:
raise exc

Expand Down
13 changes: 13 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# tox (https://tox.readthedocs.io/) is a tool for running tests
# in multiple virtualenvs. This configuration file will run the
# test suite on all supported python versions. To use it, "pip install tox"
# and then run "tox" from this directory.

[tox]
envlist = py36, py37, py38, py39, py310, py311

[testenv]
deps =

commands =
python setup.py test

0 comments on commit 56b7729

Please sign in to comment.