Skip to content
Snippets Groups Projects
Commit 75c977b5 authored by Andreas Schenk's avatar Andreas Schenk
Browse files

removed import of geom,io,mol,seq,gfx and img from ost base __init__.py

changed python unit tests to run with python instead of ost

Remarks
-------

Python unit tests using blast, clustalw or the compound lib where
skipped on my system. There might be still some missing imports in
these tests.
parent 5161efae
No related branches found
No related tags found
No related merge requests found
...@@ -423,6 +423,7 @@ macro(script) ...@@ -423,6 +423,7 @@ macro(script)
if (NOT _ARG_INPUT) if (NOT _ARG_INPUT)
message(FATAL_ERROR "script() can only substitute when INPUT is present.") message(FATAL_ERROR "script() can only substitute when INPUT is present.")
endif() endif()
substitute(IN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${_INPUT}" OUT_FILE ${_ARG_NAME} substitute(IN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${_INPUT}" OUT_FILE ${_ARG_NAME}
DICT ${_ARG_SUBSTITUTE}) DICT ${_ARG_SUBSTITUTE})
endif() endif()
...@@ -687,15 +688,21 @@ macro(ost_unittest) ...@@ -687,15 +688,21 @@ macro(ost_unittest)
set_target_properties("${_test_name}_run" PROPERTIES EXCLUDE_FROM_ALL "1") set_target_properties("${_test_name}_run" PROPERTIES EXCLUDE_FROM_ALL "1")
endif() endif()
endif() endif()
foreach(py_test ${PY_TESTS}) foreach(py_test ${PY_TESTS})
if(WIN32) if(WIN32)
set (PY_TESTS_CMD "${EXECUTABLE_OUTPUT_PATH}/ost.bat") set (PY_TESTS_CMD "${PYTHON_BINARY}")
add_custom_target("${py_test}_run" add_custom_target("${py_test}_run"
CALL "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo" CALL "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "running checks ${py_test}" VERBATIM) COMMENT "running checks ${py_test}" VERBATIM)
else() else()
set (PY_TESTS_CMD "${EXECUTABLE_OUTPUT_PATH}/ost") set(python_path $ENV{PYTHONPATH})
if(python_path)
set(python_path "${python_path}:")
endif(python_path)
set(python_path "${python_path}${LIB_STAGE_PATH}/python${PYTHON_VERSION}/site-packages")
set (PY_TESTS_CMD "PYTHONPATH=${python_path} ${PYTHON_BINARY}")
add_custom_target("${py_test}_run" add_custom_target("${py_test}_run"
sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo" sh -c "${PY_TESTS_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/${py_test} || echo"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
......
...@@ -7,5 +7,28 @@ set(OST_BASE_PYMOD_SOURCES ...@@ -7,5 +7,28 @@ set(OST_BASE_PYMOD_SOURCES
if (NOT ENABLE_STATIC) if (NOT ENABLE_STATIC)
pymod(NAME base OUTPUT_DIR ost pymod(NAME base OUTPUT_DIR ost
CPP ${OST_BASE_PYMOD_SOURCES} CPP ${OST_BASE_PYMOD_SOURCES}
PY __init__.py settings.py stutil.py table.py xmlrunner.py testutils.py) PY settings.py stutil.py table.py xmlrunner.py testutils.py)
endif() endif()
set(SQ "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'")
set(SUBST_DICT "ALL_ADDITIONAL_MODULES=")
if(ENABLE_GUI)
set(SUBST_DICT "${SUBST_DICT},${SQ}gui${SQ}")
endif(ENABLE_GUI)
if(ENABLE_GFX)
set(SUBST_DICT "${SUBST_DICT},${SQ}gfx${SQ}")
endif(ENABLE_GFX)
if(ENABLE_IMG)
set(SUBST_DICT "${SUBST_DICT},${SQ}img${SQ}")
endif(ENABLE_IMG)
if(ENABLE_INFO)
set(SUBST_DICT ${SUBST_DICT},${SQ}info${SQ})
endif(ENABLE_INFO)
script(NAME __init__.py
INPUT __init__.py.in
SUBSTITUTE "${SUBST_DICT}"
TARGET ost_base_pymod
OUTPUT_DIR "${LIB_DIR}/python${PYTHON_VERSION}/site-packages/ost")
...@@ -16,27 +16,12 @@ ...@@ -16,27 +16,12 @@
# along with this library; if not, write to the Free Software Foundation, Inc., # along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
from _ost_base import *
from stutil import *
from ost import geom
from ost import io
from ost import mol
from ost import seq
try: __all__=['Correl', 'FileLogSink', 'FloatList', 'GetCurrentLogSink', 'GetPrefixPath', 'GetSharedDataPath', 'GetVerbosityLevel', 'Histogram', 'IntList', 'LogDebug', 'LogError', 'LogInfo', 'LogScript', 'LogSink', 'LogTrace', 'LogVerbose', 'LogWarning', 'Max', 'Mean', 'Median', 'Min', 'MultiLogSink', 'PopLogSink', 'PopVerbosityLevel', 'PushLogSink', 'PushVerbosityLevel', 'Range', 'SetPrefixPath', 'StdDev', 'StreamLogSink', 'StringList', 'StringLogSink', 'Units', 'VERSION', 'VERSION_MAJOR', 'VERSION_MINOR', 'VERSION_PATCH', 'WITH_NUMPY', 'conop', 'geom', 'io', 'mol', 'seq', 'stutil' @ALL_ADDITIONAL_MODULES@]
from ost import gfx
scene = gfx.Scene()
scene.Stereo=gfx.Stereo
except ImportError:
pass
try:
from ost import img
except ImportError:
pass
from _ost_base import *
from stutil import *
class StreamLogSink(LogSink): class StreamLogSink(LogSink):
def __init__(self, stream): def __init__(self, stream):
......
...@@ -30,6 +30,7 @@ class TestLog(unittest.TestCase): ...@@ -30,6 +30,7 @@ class TestLog(unittest.TestCase):
self.severity=severity self.severity=severity
ost.PushLogSink(ls) ost.PushLogSink(ls)
ls=CapturingLogSink() ls=CapturingLogSink()
ost.PushVerbosityLevel(1)
ost.PushLogSink(ls) ost.PushLogSink(ls)
ost.LogError('error message') ost.LogError('error message')
self.assertEqual(ls.message, 'error message\n') self.assertEqual(ls.message, 'error message\n')
......
import sys
import unittest import unittest
from ost import * from ost import *
from ost import settings from ost import settings
......
import sys
import unittest import unittest
from ost import * from ost import *
from ost import settings from ost import settings
......
import sys
import unittest import unittest
from ost import geom, conop from ost import geom, conop
from ost.conop import cleanup from ost.conop import cleanup
......
...@@ -12,6 +12,9 @@ try: ...@@ -12,6 +12,9 @@ try:
except ImportError: except ImportError:
_img_present=False _img_present=False
pass pass
ost.scene = gfx.Scene()
ost.scene.Stereo=gfx.Stereo
import httplib import httplib
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
......
import unittest import unittest
import ost
from ost import * from ost import *
class TestMMCifInfo(unittest.TestCase): class TestMMCifInfo(unittest.TestCase):
......
from ost import io,mol,geom
import unittest import unittest
import os import os
import random import random
......
import sys
import unittest import unittest
from ost import * from ost import *
from ost import settings from ost import settings
......
...@@ -34,6 +34,12 @@ else: ...@@ -34,6 +34,12 @@ else:
from ost import * from ost import *
import ost import ost
try:
from ost import gfx
ost.scene = gfx.Scene()
ost.scene.Stereo=gfx.Stereo
except ImportError:
pass
ost.SetPrefixPath(os.getenv('DNG_ROOT')) ost.SetPrefixPath(os.getenv('DNG_ROOT'))
def _InitRuleBasedBuilder(): def _InitRuleBasedBuilder():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment