Skip to content

Commit

Permalink
Merge 1a4bb50 into a098913
Browse files Browse the repository at this point in the history
  • Loading branch information
HeMan committed Feb 14, 2018
2 parents a098913 + 1a4bb50 commit 463bef9
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 28 deletions.
19 changes: 10 additions & 9 deletions dev-requirements.txt
@@ -1,9 +1,10 @@
check-manifest==0.21
coverage==3.7.1
pep8==1.5.7
pep257==0.3.2
pyflakes==0.8.1
pip-tools==0.3.5
pyroma==1.6
pudb==2014.1
mock==1.0.1
check-manifest==0.36
coverage==4.5.1
mock==2.0.0
pep257==0.7.0
pycodestyle==2.3.1
pip-tools==1.11.0
pudb==2017.1.4
pyflakes==1.6.0
pyroma==2.3
pip-review==1.0
8 changes: 6 additions & 2 deletions setup.py
@@ -1,31 +1,35 @@
from os.path import dirname, join
import re
from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand
from sys import exit

package_name = "txkazoo"


def read(path):
with open(join(dirname(__file__), path)) as f:
return f.read()

import re

version_line = read("{0}/_version.py".format(package_name))
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]$", version_line, re.M)
version_string = match.group(1)

dependencies = map(str.split, read("requirements.txt").split())


class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_suite = True

def run_tests(self):
#import here, cause outside the eggs aren't loaded
# import here, cause outside the eggs aren't loaded
import tox
exit(tox.cmdline([]))


setup(name=package_name,
version=version_string,
description='Twisted binding for Kazoo',
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
@@ -1,5 +1,5 @@
[tox]
envlist = py27,meta
envlist = py27,py36,meta

[testenv]
setenv =
Expand All @@ -20,7 +20,7 @@ commands =

check-manifest --ignore .coveragerc,.travis.yml,tox.ini
pyflakes txkazoo
pep8 txkazoo
pycodestyle txkazoo
pep257 txkazoo

pip-review
Expand Down
2 changes: 1 addition & 1 deletion txkazoo/__init__.py
Expand Up @@ -21,8 +21,8 @@
"""
from txkazoo._version import __version__
version = __version__

from txkazoo.client import TxKazooClient
from txkazoo.log import TxLogger
version = __version__
__all__ = ("TxKazooClient", "TxLogger")
1 change: 0 additions & 1 deletion txkazoo/client.py
Expand Up @@ -20,7 +20,6 @@


class _RunCallbacksInReactorThreadWrapper(object):

"""
A wrapper for a Kazoo client.
Expand Down
1 change: 0 additions & 1 deletion txkazoo/log.py
Expand Up @@ -19,7 +19,6 @@


class TxLogger(object):

"""Wraps twisted's log object as a ``logging.Logger``."""

def __init__(self, log):
Expand Down
1 change: 0 additions & 1 deletion txkazoo/recipe/partitioner.py
Expand Up @@ -22,7 +22,6 @@


class _SetPartitionerWrapper(object):

"""Wrapper for :class:`~kazoo.recipe.partitioner.SetPartitioner`.
This is a Twisted-friendly wrapped based on a thread pool.
Expand Down
2 changes: 1 addition & 1 deletion txkazoo/recipe/test/__init__.py
@@ -1 +1 @@
"""Test suite for :mod:`txkazoo.recipe` functionality. """
"""Test suite for :mod:`txkazoo.recipe` functionality."""
2 changes: 1 addition & 1 deletion txkazoo/test/__init__.py
@@ -1 +1 @@
"""Test suite for base :mod:`txkazoo` functionality. """
"""Test suite for base :mod:`txkazoo` functionality."""
7 changes: 4 additions & 3 deletions txkazoo/test/test_client.py
Expand Up @@ -59,7 +59,8 @@ def test_add_listener(self):

def test_remove_listener(self):
"""Removing a listener works."""
listener = lambda state: state
def listener(state):
return state
self.wrapper.add_listener(listener)
self.assertEqual(len(self.client.listeners), 1)
self.wrapper.remove_listener(listener)
Expand All @@ -77,8 +78,8 @@ def test_regular_method(self):
Regular methods (methods that do not have a watch function) can be
accessed through the wrapper.
"""
self.assertIdentical(self.wrapper.close.im_func,
self.client.close.im_func)
self.assertIdentical(self.wrapper.close.__func__,
self.client.close.__func__)

def test_watch_function_method(self):
"""
Expand Down
8 changes: 2 additions & 6 deletions txkazoo/test/util.py
Expand Up @@ -22,7 +22,6 @@


class FakeKazooClient(object):

"""A fake Kazoo client for testing."""

def __init__(self):
Expand Down Expand Up @@ -54,7 +53,6 @@ def SetPartitioner(self, *args, **kwargs):


class FakeLock(object):

"""A fake Lock for testing."""

def __init__(self, path, identifier=None):
Expand All @@ -64,7 +62,6 @@ def __init__(self, path, identifier=None):


class FakeSetPartitioner(object):

"""A fake SetPartitioner for testing."""

def __init__(self, *args, **kwargs):
Expand All @@ -78,7 +75,6 @@ def __iter__(self):


class FakeThreadPool(object):

"""A fake thread pool, for testing.
It actually just runs things synchronously in the calling thread.
Expand All @@ -97,7 +93,8 @@ def callInThreadWithCallback(self, onResult, func, *args, **kw):
succeeded, or :const:`False` and the failure if it failed.
"""
if onResult is None:
onResult = lambda success, result: None
def onResult(success, result):
return None

try:
result = func(*args, **kw)
Expand All @@ -109,7 +106,6 @@ def callInThreadWithCallback(self, onResult, func, *args, **kw):

@implementer(IReactorThreads)
class FakeReactor(object):

"""A fake threaded reactor, for testing."""

def __init__(self):
Expand Down

0 comments on commit 463bef9

Please sign in to comment.