Skip to content

Commit

Permalink
cython: cleanup cmakefiles for nosetests
Browse files Browse the repository at this point in the history
  • Loading branch information
linas committed Oct 7, 2013
1 parent bb48190 commit cc9ad5f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
18 changes: 12 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ ENDIF(PYTHONLIBS_FOUND)
# Python bindings using Cython
# Cython is used to generate bindings
FIND_PROGRAM(CYTHON_EXECUTABLE cython)
FIND_PROGRAM(NOSETESTS_EXECUTABLE nosetests)
IF (CYTHON_EXECUTABLE AND PYTHONLIBS_FOUND)
# find python destination dir for python bindings
ADD_DEFINITIONS(-DHAVE_CYTHON)
Expand All @@ -351,6 +350,12 @@ ELSE (CYTHON_EXECUTABLE AND PYTHONLIBS_FOUND)
ENDIF(NOT CYTHON_EXECUTABLE)
ENDIF (CYTHON_EXECUTABLE AND PYTHONLIBS_FOUND)

# Nosetests will find and automatically run python tests.
FIND_PROGRAM(NOSETESTS_EXECUTABLE nosetests)
IF (NOSETESTS_EXECUTABLE)
SET(HAVE_NOSETESTS 1)
ENDIF (NOSETESTS_EXECUTABLE)

# SDL needed for the spatial tools
FIND_PACKAGE(SDL)

Expand Down Expand Up @@ -684,23 +689,24 @@ ADD_SUBDIRECTORY(doc EXCLUDE_FROM_ALL)
SUMMARY_ADD("AtomSpace" "A weighted and typed hypergraph database" HAVE_ATOMSPACE)
SUMMARY_ADD("Attention" "Agents for attention allocation dynamics" HAVE_ATTENTION)
SUMMARY_ADD("ComboReduct" "Library for reduction of combo program trees" HAVE_COMBOREDUCT)
SUMMARY_ADD("CythonBinding" "Cython (python) bindings" HAVE_CYTHON)
SUMMARY_ADD("Cython bindings" "Cython (python) bindings" HAVE_CYTHON)
SUMMARY_ADD("Dim. Embedding" "Compute dimensional embedding of the AtomSpace" HAVE_DIMEMBED)
SUMMARY_ADD("Doxygen" "Code documentation" DOXYGEN_FOUND)
SUMMARY_ADD("Embodiment" "Architecture for embodiment" HAVE_EMBODIMENT)
SUMMARY_ADD("FeatureSelection" "MOSES based feature selection tool" HAVE_FEATURE_SELECTION)
SUMMARY_ADD("Feature selection" "MOSES based feature selection tool" HAVE_FEATURE_SELECTION)
SUMMARY_ADD("GTK Visualizer" "GTK3-based Atomspace Visualizer" HAVE_GTK)
SUMMARY_ADD("Hypertable" "HyperTable for scalable persistance (experimental)" HAVE_HYPERTABLE)
SUMMARY_ADD("MOSES" "Meta-Optimizing Semantic Evolutionary Search" HAVE_MOSES)
SUMMARY_ADD("PLN" "Probalistic Logic Networks" HAVE_PLN)
SUMMARY_ADD("SchemeBinding" "Scheme bindings and shell" HAVE_GUILE)
SUMMARY_ADD("Python tests" "Python bindings nose tests" HAVE_NOSETESTS)
SUMMARY_ADD("Scheme bindings" "Scheme bindings and shell" HAVE_GUILE)
SUMMARY_ADD("Server" "The CogServer" HAVE_SERVER)
SUMMARY_ADD("Spatial" "Vizualisation of the 3D spacemap" HAVE_SPATIAL_TOOLS)
SUMMARY_ADD("SQL Persist" "Interfaces for SQL persistance of the AtomSpace" HAVE_PERSIST)
SUMMARY_ADD("SQL persistance" "Interfaces for SQL persistance of the AtomSpace" HAVE_PERSIST)
SUMMARY_ADD("Ubigraph" "Visualisation of the AtomSpace" HAVE_UBIGRAPH)
SUMMARY_ADD("Util" "General utility library" HAVE_UTIL)
SUMMARY_ADD("Viterbi" "Viterbi Parser for Link Grammar" HAVE_VITERBI)
SUMMARY_ADD("WebInterface" "Web server and REST API" HAVE_WEB)
SUMMARY_ADD("Web Interface" "Web server and REST API" HAVE_WEB)
SUMMARY_SHOW()


19 changes: 9 additions & 10 deletions tests/cython/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ INCLUDE_DIRECTORIES(
${PYTHON_INCLUDE_PATH}
)

IF (NOSETESTS_EXECUTABLE)
ADD_TEST(Cython ${NOSETESTS_EXECUTABLE} -vs
${CMAKE_SOURCE_DIR}/tests/cython/)
SET_TESTS_PROPERTIES(Cython
PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/opencog/cython:${PROJECT_SOURCE_DIR}/tests/cython/agents")

ELSE (NOSETESTS_EXECUTABLE)
MESSAGE(WARNING "Nosetests executable for testing Python bindings not found. Install with \"sudo easy_install nose\".")
ENDIF (NOSETESTS_EXECUTABLE)

ADD_CXXTEST(PythonModuleUTest)
ADD_DEPENDENCIES(PythonModuleUTest
PythonModule
Expand All @@ -27,3 +17,12 @@ TARGET_LINK_LIBRARIES(PythonModuleUTest
SET_TESTS_PROPERTIES(PythonModuleUTest
PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/opencog/cython")


# Don't run nose tests until after the python module checks out OK.
IF (HAVE_NOSETESTS)
ADD_TEST(Cython ${NOSETESTS_EXECUTABLE} -vs
${CMAKE_SOURCE_DIR}/tests/cython/)
SET_TESTS_PROPERTIES(Cython
PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/opencog/cython:${PROJECT_SOURCE_DIR}/tests/cython/agents")
ENDIF (HAVE_NOSETESTS)

0 comments on commit cc9ad5f

Please sign in to comment.