mirror of
https://github.com/rdkit/rdkit.git
synced 2026-06-03 21:44:30 +08:00
Allow installation of Python tests to facilitate testing installations (#1724)
* first pass at adding an installation option for running the python tests * only install the run_python_tests script if the tests themselves are installed
This commit is contained in:
committed by
Brian Kelley
parent
503b84995c
commit
0d0cce3122
@@ -25,6 +25,7 @@ option(RDK_PGSQL_STATIC "statically link rdkit libraries into the PostgreSQL car
|
||||
option(RDK_BUILD_CONTRIB "build the Contrib directory" OFF )
|
||||
option(RDK_INSTALL_INTREE "install the rdkit in the source tree (former behavior)" ON )
|
||||
option(RDK_INSTALL_STATIC_LIBS "install the rdkit static libraries" ON )
|
||||
option(RDK_INSTALL_PYTHON_TESTS "install the rdkit Python tests with the wrappers" OFF )
|
||||
option(RDK_BUILD_THREADSAFE_SSS "enable thread-safe substructure searching (requires boost.thread)" ON )
|
||||
option(RDK_BUILD_SLN_SUPPORT "include support for the SLN format" ON )
|
||||
option(RDK_TEST_MULTITHREADED "run some tests of multithreading" ON )
|
||||
@@ -200,17 +201,27 @@ if(RDK_BUILD_PYTHON_WRAPPERS)
|
||||
)
|
||||
endif (NOT PYTHON_INSTDIR)
|
||||
message("Python Install directory ${PYTHON_INSTDIR}")
|
||||
install(DIRECTORY rdkit DESTINATION ${PYTHON_INSTDIR}
|
||||
COMPONENT python
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN "test_data" EXCLUDE
|
||||
PATTERN "testData" EXCLUDE
|
||||
PATTERN "test_list*" EXCLUDE
|
||||
PATTERN "CMake*" EXCLUDE
|
||||
PATTERN "Basement" EXCLUDE
|
||||
PATTERN "UnitTest*" EXCLUDE
|
||||
)
|
||||
set(RDKit_PythonDir "${PYTHON_INSTDIR}/rdkit")
|
||||
if(RDK_INSTALL_PYTHON_TESTS)
|
||||
install(DIRECTORY rdkit DESTINATION ${PYTHON_INSTDIR}
|
||||
COMPONENT python
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN "CMake*" EXCLUDE
|
||||
PATTERN "Basement" EXCLUDE
|
||||
)
|
||||
else(RDK_INSTALL_PYTHON_TESTS)
|
||||
install(DIRECTORY rdkit DESTINATION ${PYTHON_INSTDIR}
|
||||
COMPONENT python
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN "test_data" EXCLUDE
|
||||
PATTERN "testData" EXCLUDE
|
||||
PATTERN "test_list*" EXCLUDE
|
||||
PATTERN "CMake*" EXCLUDE
|
||||
PATTERN "Basement" EXCLUDE
|
||||
PATTERN "UnitTest*" EXCLUDE
|
||||
)
|
||||
endif(RDK_INSTALL_PYTHON_TESTS)
|
||||
|
||||
endif(RDK_INSTALL_INTREE)
|
||||
|
||||
else(RDK_BUILD_PYTHON_WRAPPERS)
|
||||
@@ -346,6 +357,22 @@ if(NOT RDK_INSTALL_INTREE)
|
||||
PATTERN "test_list*" EXCLUDE
|
||||
PATTERN "CMake*" EXCLUDE
|
||||
)
|
||||
if(RDK_INSTALL_PYTHON_TESTS)
|
||||
install(DIRECTORY Scripts DESTINATION
|
||||
${RDKit_ShareDir}
|
||||
COMPONENT data
|
||||
PATTERN ".svn" EXCLUDE
|
||||
)
|
||||
else(RDK_INSTALL_PYTHON_TESTS)
|
||||
install(DIRECTORY Scripts DESTINATION
|
||||
${RDKit_ShareDir}
|
||||
COMPONENT data
|
||||
PATTERN ".svn" EXCLUDE
|
||||
PATTERN "run_python_tests.py" EXCLUDE
|
||||
)
|
||||
endif(RDK_INSTALL_PYTHON_TESTS)
|
||||
|
||||
|
||||
endif(RDK_BUILD_PYTHON_WRAPPERS)
|
||||
install(FILES README license.txt
|
||||
DESTINATION ${RDKit_ShareDir}
|
||||
|
||||
22
Scripts/run_python_tests.py
Normal file
22
Scripts/run_python_tests.py
Normal file
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Copyright (C) 2018 Greg Landrum
|
||||
# All Rights Reserved
|
||||
#
|
||||
# This file is part of the RDKit.
|
||||
# The contents are covered by the terms of the BSD license
|
||||
# which is included in the file license.txt, found at the root
|
||||
# of the RDKit source tree.
|
||||
#
|
||||
from rdkit import RDConfig
|
||||
from rdkit import TestRunner
|
||||
import os,time,sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
script = 'test_list.py'
|
||||
os.chdir(RDConfig.RDCodeDir)
|
||||
t1 = time.time()
|
||||
failed,nTests = TestRunner.RunScript(script,doLongTests=False,\
|
||||
verbose=True)
|
||||
t2 = time.time()
|
||||
TestRunner.ReportResults(script,failed,nTests,t2-t1,verbose=True,dest=sys.stderr)
|
||||
sys.exit(len(failed))
|
||||
@@ -1,4 +1,3 @@
|
||||
# $Id$
|
||||
#
|
||||
# Copyright (c) 2003-2010 Greg Landrum and Rational Discovery LLC
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user