-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from ethertricity/restore_telnet
Restore tcp 'Ok' response
- Loading branch information
Showing
9 changed files
with
154 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ __pycache__/ | |
*.sublime* | ||
*.atom-build* | ||
*.build-tools* | ||
.idea/* | ||
|
||
# C extensions | ||
*.so | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.PHONY: test | ||
test: | ||
@python -m pytest bluesky/test | ||
@echo "Running Tests using Python2 BlueSky" | ||
TESTING=true PYEXEC=python2 python3 -m pytest -s bluesky/test | ||
@echo "Running Tests using Python3 BlueSky" | ||
TESTING=true PYEXEC=python3 python3 -m pytest -s bluesky/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
Copyright (c) 2017 SPARKL Limited. All Rights Reserved. | ||
For inclusion with BlueSky upstream code: | ||
https://github.com/ProfHoekstra/bluesky/, distributed under | ||
GNU General Public License v3. | ||
Author <ahfarrell@sparkl.com> Andrew Farrell | ||
Common test fixtures. | ||
NOTE - The test suite is written in Python3 only. | ||
It tests BlueSky running in either Python2 or 3. | ||
""" | ||
from __future__ import print_function | ||
import pytest | ||
import sys | ||
import socket | ||
import os | ||
import psutil | ||
import subprocess | ||
import signal | ||
import bluesky | ||
from .. import sock_connect, wait_for, TCP_HOST, TCP_PORT, BLUESKY | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def sock(pytestconfig): | ||
""" | ||
Suite-level setup and teardown function, for those test functions | ||
naming `sock` in their parameter lists. | ||
""" | ||
newpid = os.fork() | ||
if newpid != 0: | ||
sock_ = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||
wait_for( | ||
lambda: sock_connect(sock_, TCP_HOST, TCP_PORT), -1, 5) | ||
yield sock_, bluesky | ||
sock_.close() | ||
parent_pid = os.getpid() | ||
parent = psutil.Process(parent_pid) | ||
children = parent.children(recursive=True) | ||
for child in children: | ||
try: | ||
child.send_signal(signal.SIGKILL) | ||
except psutil.NoSuchProcess: | ||
pass | ||
else: | ||
subprocess.call([os.environ['PYEXEC'], BLUESKY]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters