Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
647-coder committed Sep 27, 2019
1 parent 27f65b4 commit 1cd0427
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 33 deletions.
14 changes: 6 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
language: python
python: 3.4
dist: precise
python:
- "2.7"
- "3.4"
- "pypy"
services:
- mysql
- redis-server
env:
- TOXENV=flake8
- TOXENV=py27
- TOXENV=py33
- TOXENV=py34
- TOXENV=pypy
before_install:
- pip install tox
- pip install tox==1.9.2
before_script:
# enable row-based binlog
- sudo touch /etc/mysql/conf.d/replication.cnf
Expand Down
2 changes: 1 addition & 1 deletion examples/repl_db/repl.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _update_by_pk(name, pk):
for col in columns:
try:
val = getattr(obj, col)
except AttributeError as e:
except AttributeError:
continue
setattr(s_obj, col, val)

Expand Down
2 changes: 1 addition & 1 deletion meepo/apps/eventsourcing/event_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class RedisEventStore(EventStore):
end
""".split())

def __init__(self, redis_dsn, namespace=None, ttl=3600*24*3,
def __init__(self, redis_dsn, namespace=None, ttl=3600 * 24 * 3,
socket_timeout=1, **kwargs):
super(RedisEventStore, self).__init__()

Expand Down
2 changes: 1 addition & 1 deletion meepo/apps/eventsourcing/prepare_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class RedisPrepareCommit(PrepareCommit):
:param socket_timeout: redis socket timeout
:param kwargs: kwargs to be passed to redis instance init func.
"""
def __init__(self, redis_dsn, strict=False, namespace=None, ttl=3600*24,
def __init__(self, redis_dsn, strict=False, namespace=None, ttl=3600 * 24,
socket_timeout=1, **kwargs):
super(RedisPrepareCommit, self).__init__()

Expand Down
4 changes: 2 additions & 2 deletions meepo/apps/eventsourcing/sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def redis_es_sub(session, tables, redis_dsn, strict=False,
namespace=None, ttl=3600*24*3, socket_timeout=1):
namespace=None, ttl=3600 * 24 * 3, socket_timeout=1):
"""Redis EventSourcing sub.
This sub should be used together with sqlalchemy_es_pub, it will
Expand Down Expand Up @@ -52,7 +52,7 @@ def _es_event_sub(pk, event):
logger.error("event sourcing failed: %s" % pk)

events = ("%s_%s" % (tb, action) for tb, action in
itertools.product(*[tables, ["write", "update", "delete"]]))
itertools.product(*[tables, ["write", "update", "delete"]]))
for event in events:
sub_func = functools.partial(_es_event_sub, event=event)
signal(event).connect(sub_func, weak=False)
Expand Down
2 changes: 2 additions & 0 deletions meepo/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def hashable_identity(obj):

import blinker.base
blinker.base.hashable_identity = hashable_identity


_monkey_patch_hashable_func()


Expand Down
2 changes: 1 addition & 1 deletion meepo/sub/statsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def statsd_sub(statsd_dsn, tables, prefix="meepo.stats", rate=1):
itertools.product(*[tables, ["write", "update", "delete"]]))
for event in events:
signal(event).connect(
lambda _, e=event: c.incr(_key(*e.rsplit('_', 1)), rate=rate),
lambda _, e=event: c.incr(_key(*e.rsplit('_', 1)), rate=rate),
weak=False
)

Expand Down
6 changes: 6 additions & 0 deletions meepo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ def cast_bytes(s, encoding='utf8', errors='strict'):
return s.encode(encoding, errors)
else:
raise TypeError("Expected unicode or bytes, got %r" % s)


b = cast_bytes


Expand All @@ -62,6 +64,8 @@ def cast_str(s, encoding='utf8', errors='strict'):
return s
else:
raise TypeError("Expected unicode or bytes, got %r" % s)


s = cast_str


Expand All @@ -71,4 +75,6 @@ def cast_datetime(ts, fmt=None):
if fmt:
return dt.strftime(fmt)
return dt


d = cast_datetime
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
install_requires = [
"SQLAlchemy>=0.9.0,<1.1.0",
"blinker>=1.3,<2.0",
"mysql-replication>=0.5,<0.6.0",
"mysql-replication>=0.5",
"pyketama>=0.2.0",
"pyzmq>=14.3.1,<15.0.0",
"redis>=2.10.3,<2.11.0",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_eventsourcing/test_sqlalchemy_es_pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_sa_mixed_write_update_delete_and_multi_flushes(session, model_cls):
5. commit
"""
t_b, t_c = session.query(model_cls). \
filter(model_cls.data.in_(('b', 'c'))).all()
filter(model_cls.data.in_(('b', 'c'))).all()
t_e = model_cls(data='e')
session.add(t_e)
t_b.data = "x"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mysql_pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_sg(sg_list):
signal("test_delete_raw").connect(test_sg(t_raw_deletes), weak=False)

# connect mysql binlog pos signal
signal("mysql_binlog_pos").connect(test_sg(t_binlogs), weak=False)
signal("mysql_binlog_pos").connect(test_sg(t_binlogs), weak=False)


@pytest.fixture(scope="module")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_sqlalchemy_pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_sa_mixed_write_update_delete_and_multi_flushes(session, model_cls):
5. commit
"""
t_b, t_c = session.query(model_cls).\
filter(model_cls.data.in_(('b', 'c'))).all()
filter(model_cls.data.in_(('b', 'c'))).all()
t_e = model_cls(data='e')
session.add(t_e)
t_b.data = "x"
Expand Down
21 changes: 6 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
[tox]
envlist = flake8, py27, py33, py34, pypy

[testenv]
basepython =
py27: python2.7
py33: python3.3
py34: python3.4
pypy: pypy
deps =
mysql-replication>=0.5
pytest>=2.6.4
pytest>=2.6.4,<3.0.0
redis>=2.10.3
teamcity-messages>=1.8
PyMySQL>0.7.0,<0.8.0
flake8>=2.2.5
commands =
python --version
flake8 .
py.test {posargs}

[testenv:flake8]
basepython = python
deps =
flake8 >=2.2.5
commands =
flake8 .
[flake8]
ignore = E402, E731

0 comments on commit 1cd0427

Please sign in to comment.