Skip to content
Snippets Groups Projects
Commit e97695e9 authored by Manuel Günther's avatar Manuel Günther
Browse files

Added nose test to test the package

parent f90e6a2c
No related branches found
No related tags found
No related merge requests found
test.py 0 → 100644
def test_package():
# This function tests that the example actually runs
# As the test requires that buildout already ran, we do not run buildout again
import subprocess
import os, shutil
import tempfile
import bob.extension
tmp = tempfile.mkdtemp(prefix="bobtest_")
here = os.path.dirname(os.path.realpath(__file__))
try:
# find cmake executable
cmake = bob.extension.find_executable("cmake")
assert len(cmake)
cmake = cmake[0]
# run cmake in the temp directory
assert subprocess.call([cmake, here], cwd=tmp) == 0
assert subprocess.call(['make'], cwd=tmp) == 0
# run the test executable
assert os.path.exists(os.path.join(tmp, "my_test"))
shutil.copy(os.path.join(here, "test.png"), tmp)
assert subprocess.call(["./my_test"], cwd=tmp) == 0
# assert that the test outout file actually was created
assert os.path.exists(os.path.join(tmp, "test.hdf5"))
finally:
shutil.rmtree(tmp)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment