From 2464c8b9ee1a10273995ab16b81d958f2a2e90d1 Mon Sep 17 00:00:00 2001 From: Tom Vierjahn Date: Wed, 17 Jan 2018 15:51:35 +0100 Subject: [PATCH] Move python cout capture test to separate py file --- pyniv/tests/src/test_cout_capture.py | 32 ++++++++++++++++++++++++++++ pyniv/tests/src/test_pynpv.py | 16 -------------- 2 files changed, 32 insertions(+), 16 deletions(-) create mode 100644 pyniv/tests/src/test_cout_capture.py diff --git a/pyniv/tests/src/test_cout_capture.py b/pyniv/tests/src/test_cout_capture.py new file mode 100644 index 0000000..798ff3d --- /dev/null +++ b/pyniv/tests/src/test_cout_capture.py @@ -0,0 +1,32 @@ +#------------------------------------------------------------------------------- +# nest in situ vis +# +# Copyright (c) 2017-2018 RWTH Aachen University, Germany, +# Virtual Reality & Immersive Visualisation Group. +#------------------------------------------------------------------------------- +# License +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------------- + +import sys + +def test_cout_capture(capsys): + print("hello") + sys.stderr.write("world\n") + out, err = capsys.readouterr() + assert out == "hello\n" + assert err == "world\n" + print ("next") + out, err = capsys.readouterr() + assert out == "next\n" diff --git a/pyniv/tests/src/test_pynpv.py b/pyniv/tests/src/test_pynpv.py index 1021a5e..8dd3e6c 100644 --- a/pyniv/tests/src/test_pynpv.py +++ b/pyniv/tests/src/test_pynpv.py @@ -19,26 +19,10 @@ # limitations under the License. #------------------------------------------------------------------------------- -import ctypes -import sys -import time - import pyniv -import pytest_utilities - def test_pypvt(): assert True -def test_cout_capture(capsys): - print("hello") - sys.stderr.write("world\n") - out, err = capsys.readouterr() - assert out == "hello\n" - assert err == "world\n" - print ("next") - out, err = capsys.readouterr() - assert out == "next\n" - def test_pyniv_greet(): assert pyniv.Greet() == "G'day!"