Skip to content

Commit

Permalink
Merge ada223d into 18f2e4f
Browse files Browse the repository at this point in the history
  • Loading branch information
wallacbe committed Dec 2, 2017
2 parents 18f2e4f + ada223d commit 8a30bbf
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: python
python:
# - '2.7'
- '2.7'
- '3.6'
addons:
apt:
Expand All @@ -16,7 +16,7 @@ cache:
directories:
- $HOME/.cache/pip
env:
#- TOXENV=py27
- TOXENV=py27
- TOXENV=py36
install:
- pip install tox coveralls
Expand Down
13 changes: 13 additions & 0 deletions openhtf/util/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,19 @@ def __next__(self):
self.last_result = self._handle_phase(
openhtf.PhaseDescriptor.wrap_or_copy(phase_or_test))
return phase_or_test, self.last_result

def next(self):
phase_or_test = self.iterator.send(self.last_result)
if isinstance(phase_or_test, openhtf.Test):
self.last_result = self._handle_test(phase_or_test)
elif not isinstance(phase_or_test, collections.Callable):
raise InvalidTestError(
'methods decorated with patch_plugs must yield Test instances or '
'individual test phases', phase_or_test)
else:
self.last_result = self._handle_phase(
openhtf.PhaseDescriptor.wrap_or_copy(phase_or_test))
return phase_or_test, self.last_result


def yields_phases(func):
Expand Down
5 changes: 3 additions & 2 deletions openhtf/util/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def MyPhase(test):
import numbers
import re
import sys
from future.utils import with_metaclass
from openhtf import util

_VALIDATORS = {}
Expand All @@ -81,13 +82,13 @@ def create_validator(name, *args, **kwargs):
_identity = lambda x: x


class ValidatorBase(object, metaclass=abc.ABCMeta):
class ValidatorBase(with_metaclass(abc.ABCMeta, object)):
@abc.abstractmethod
def __call__(self, value):
"""Should validate value, returning a boolean result."""


class RangeValidatorBase(ValidatorBase, metaclass=abc.ABCMeta):
class RangeValidatorBase(with_metaclass(abc.ABCMeta, ValidatorBase)):
@abc.abstractproperty
def minimum(self):
"""Should return the minimum, inclusive value of the range."""
Expand Down
9 changes: 8 additions & 1 deletion openhtf/util/xmlrpcutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@

import http.client
import xmlrpc.server
import os
import socketserver
import sys
import threading
import xmlrpc.client
import collections

DEFAULT_PROXY_TIMEOUT_S = 3

if sys.version_info[0] < 3:
from SimpleXMLRPCServer import SimpleXMLRPCServer
else:
from xmlrpc.server import SimpleXMLRPCServer as SimpleXMLRPCServer


class TimeoutHTTPConnection(http.client.HTTPConnection):
def __init__(self, timeout_s, *args, **kwargs):
Expand Down Expand Up @@ -100,6 +107,6 @@ class LockedTimeoutProxy(TimeoutProxyMixin, LockedProxyMixin, BaseServerProxy):


class SimpleThreadedXmlRpcServer(
socketserver.ThreadingMixIn, xmlrpc.server.SimpleXMLRPCServer):
socketserver.ThreadingMixIn, SimpleXMLRPCServer):
"""Helper for handling multiple simultaneous RPCs in threads."""
daemon_threads = True
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ class BuildProtoCommand(Command):
def initialize_options(self):
self.skip_proto = False
try:
prefix = subprocess.getoutput(
'pkg-config --variable prefix protobuf').strip()
if sys.version_info[0] < 3:
prefix = subprocess.check_output(
'pkg-config --variable prefix protobuf'.split()).strip()
else:
prefix = subprocess.getoutput(
'pkg-config --variable prefix protobuf').strip()
except (subprocess.CalledProcessError, OSError):
if platform.system() == 'Linux':
# Default to /usr?
Expand Down Expand Up @@ -114,6 +118,7 @@ def run(self):
INSTALL_REQUIRES = [
'contextlib2>=0.5.1,<1.0',
'enum34>=1.1.2,<2.0',
'future>=0.16.0',
'mutablerecords>=0.4.1,<2.0',
'oauth2client>=1.5.2,<2.0',
'protobuf>=3.0.0,<4.0',
Expand Down

0 comments on commit 8a30bbf

Please sign in to comment.