Skip to content

Commit

Permalink
Move python cout capture test to separate py file
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvierjahn committed Jan 17, 2018
1 parent 8ca1a03 commit 2464c8b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
32 changes: 32 additions & 0 deletions pyniv/tests/src/test_cout_capture.py
Original file line number Diff line number Diff line change
@@ -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"
16 changes: 0 additions & 16 deletions pyniv/tests/src/test_pynpv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!"

0 comments on commit 2464c8b

Please sign in to comment.