Skip to content

Commit

Permalink
Merge pull request morganstanley#275 from ryan-collingham/rlc/win_ski…
Browse files Browse the repository at this point in the history
…p_fix

Skip FIX example on Windows and add warning to Fix Server
  • Loading branch information
ryan-collingham authored Sep 11, 2019
2 parents fd01f37 + e9961c4 commit 676077e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/Transports/FIX/test_plan.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env python
"""
This example demonstrates FIX communication via FixServer and FixClient drivers.
NOTE: The FixServer driver implementation requires select.poll(), which is not
available on all platforms. Typically it is available on POSIX systems but
not on Windows. This example will not run correctly on platforms where
select.poll() is not available.
"""

import sys
Expand Down
13 changes: 13 additions & 0 deletions testplan/testing/multitest/driver/fix/server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""FixServer driver classes."""

import os
import select
import platform

from six.moves import queue
from schema import Use
Expand Down Expand Up @@ -46,6 +48,10 @@ class FixServer(Driver):
:py:class:`testplan.common.utils.sockets.fix.server.Server` class, which
provides equivalent functionality and may be used outside of MultiTest.
NOTE: FixServer requires select.poll(), which is not implemented on all
operating systems - typically it is available on POSIX systems but not
on Windows.
:param name: Name of FixServer.
:type name: ``str``
:param msgclass: Type used to send and receive FIX messages.
Expand Down Expand Up @@ -76,6 +82,13 @@ def __init__(self,
**options
):
options.update(self.filter_locals(locals()))

if not hasattr(select, 'poll'):
raise RuntimeError(
'select.poll() is required for FixServer but is not available '
'on the current platform ({})'.format(platform.system())
)

super(FixServer, self).__init__(**options)
self._host = None
self._port = None
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/examples/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
r"ImportError: No module named _tkinter.*", # Missing module Tkinter. Will skip Data Science example.
r"RuntimeError: Download pyfixmsg library .*", # Missing module pyfixmsg. Will skip FIX example.
r"No spec file set\. You should download .*", # Missing FIX spec file. Will skip FIX example.
r"AttributeError: 'module' object has no attribute 'poll'",
r"RuntimeError: You need to compile test binary first.", # Need to compile cpp binary first. Will skip GTest example.
r"FATAL ERROR: Network error: Connection refused", # We don't fail a pool test for connection incapability.
r"lost connection"
Expand All @@ -48,6 +47,7 @@
SKIP_ON_WINDOWS = [
os.path.join('Cpp', 'GTest', 'test_plan.py'),
os.path.join('Cpp', 'HobbesTest', 'test_plan.py'),
os.path.join('Transports', 'FIX', 'test_plan.py'),
]

# Contents to look for under root dir.
Expand Down

0 comments on commit 676077e

Please sign in to comment.