Fix Python libs tests
This commit is contained in:
parent
3e81a75b0c
commit
2127b9e815
@ -4,7 +4,7 @@ let
|
|||||||
owner = "NixOS";
|
owner = "NixOS";
|
||||||
repo = "nixpkgs-channels";
|
repo = "nixpkgs-channels";
|
||||||
rev = "nixos-unstable";
|
rev = "nixos-unstable";
|
||||||
sha256 = "15fcl29a97f68j1pjywmrjm31rdh1a21jz9airlsbzpl4lc3zhfi";
|
sha256 = "1rc1pjnvfi194gka45zc1nivzsncc819kvxlfv277l2c8ryhgbpc";
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
with import nixpkgs {};
|
with import nixpkgs {};
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
add_executable(example example.cpp)
|
add_executable(example example.cpp)
|
||||||
target_link_libraries(example ${PYTHON_LIBRARIES})
|
target_include_directories(example SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(example PUBLIC ${PYTHON_LIBRARIES})
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
add_executable(example example.cpp)
|
add_executable(example example.cpp)
|
||||||
|
target_include_directories(example SYSTEM PUBLIC ${PYTHON_INCLUDE_DIRS})
|
||||||
target_link_libraries(example ${PYTHON_LIBRARIES})
|
target_link_libraries(example ${PYTHON_LIBRARIES})
|
||||||
|
30
test/test.py
30
test/test.py
@ -10,8 +10,10 @@ import pytest
|
|||||||
|
|
||||||
HERE = os.path.abspath(os.path.dirname(__file__))
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
skip_on_osx = pytest.mark.skipif('sys.platform == "darwin"', reason="not working on osx")
|
skip_on_osx = pytest.mark.skipif(
|
||||||
skip_on_linux = pytest.mark.skipif('sys.platform == "linux2"', reason="not working on linux")
|
'sys.platform == "darwin"', reason="not working on osx")
|
||||||
|
skip_on_linux = pytest.mark.skipif(
|
||||||
|
'sys.platform == "linux2"', reason="not working on linux")
|
||||||
skip_always = pytest.mark.skipif('1 == 1', reason="tests are broken")
|
skip_always = pytest.mark.skipif('1 == 1', reason="tests are broken")
|
||||||
|
|
||||||
|
|
||||||
@ -27,10 +29,11 @@ def exe(command):
|
|||||||
communicate() method.
|
communicate() method.
|
||||||
See https://docs.python.org/2/library/subprocess.html
|
See https://docs.python.org/2/library/subprocess.html
|
||||||
"""
|
"""
|
||||||
stdout, stderr = subprocess.Popen(shlex.split(command),
|
stdout, stderr = subprocess.Popen(
|
||||||
stdout=subprocess.PIPE,
|
shlex.split(command),
|
||||||
stderr=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
universal_newlines=True).communicate()
|
stderr=subprocess.PIPE,
|
||||||
|
universal_newlines=True).communicate()
|
||||||
|
|
||||||
if stderr:
|
if stderr:
|
||||||
sys.stderr.write(stdout)
|
sys.stderr.write(stdout)
|
||||||
@ -41,7 +44,8 @@ def exe(command):
|
|||||||
|
|
||||||
def configure_build_and_exe(name, setup_command, launcher=None):
|
def configure_build_and_exe(name, setup_command, launcher=None):
|
||||||
|
|
||||||
stamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d-%H-%M-%S')
|
stamp = datetime.datetime.fromtimestamp(
|
||||||
|
time.time()).strftime('%Y-%m-%d-%H-%M-%S')
|
||||||
|
|
||||||
os.chdir(os.path.join(HERE, name, 'cmake'))
|
os.chdir(os.path.join(HERE, name, 'cmake'))
|
||||||
shutil.copy(os.path.join('..', '..', '..', 'update.py'), 'update.py')
|
shutil.copy(os.path.join('..', '..', '..', 'update.py'), 'update.py')
|
||||||
@ -80,7 +84,10 @@ def configure_build_and_exe(name, setup_command, launcher=None):
|
|||||||
|
|
||||||
|
|
||||||
def test_extra_cmake_options():
|
def test_extra_cmake_options():
|
||||||
configure_build_and_exe('extra_cmake_options', 'python setup --cxx=g++ --cmake-options="-DENABLE_SOMETHING=OFF -DENABLE_FOO=ON"')
|
configure_build_and_exe(
|
||||||
|
'extra_cmake_options',
|
||||||
|
'python setup --cxx=g++ --cmake-options="-DENABLE_SOMETHING=OFF -DENABLE_FOO=ON"'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_cxx():
|
def test_cxx():
|
||||||
@ -120,7 +127,8 @@ def test_cxx_cblas():
|
|||||||
|
|
||||||
@skip_on_linux
|
@skip_on_linux
|
||||||
def test_cxx_accelerate():
|
def test_cxx_accelerate():
|
||||||
configure_build_and_exe('cxx_accelerate', 'python setup --cxx=g++ --accelerate')
|
configure_build_and_exe('cxx_accelerate',
|
||||||
|
'python setup --cxx=g++ --accelerate')
|
||||||
|
|
||||||
|
|
||||||
def test_python_interpreter():
|
def test_python_interpreter():
|
||||||
@ -138,7 +146,9 @@ def test_python_libs():
|
|||||||
|
|
||||||
def test_python_libs_custom():
|
def test_python_libs_custom():
|
||||||
python_executable = sys.executable
|
python_executable = sys.executable
|
||||||
configure_build_and_exe('python_libs_custom', 'python setup --cxx=g++ --python={0}'.format(python_executable))
|
configure_build_and_exe(
|
||||||
|
'python_libs_custom',
|
||||||
|
'python setup --cxx=g++ --python={0}'.format(python_executable))
|
||||||
|
|
||||||
|
|
||||||
def test_boost_header_only():
|
def test_boost_header_only():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user