pybind11: test functionality (#8304)

* pybind11: test support

Add a test functionality to pybind11.

* CMake: test also on "make check"

Some projects use non-CTest manual targets for tests.
This commit is contained in:
Axel Huebl 2018-06-04 16:50:02 +02:00 committed by Adam J. Stewart
parent 20a89ca326
commit add7f2b09a
2 changed files with 7 additions and 1 deletions

View file

@ -256,8 +256,10 @@ def check(self):
with working_dir(self.build_directory): with working_dir(self.build_directory):
if self.generator == 'Unix Makefiles': if self.generator == 'Unix Makefiles':
self._if_make_target_execute('test') self._if_make_target_execute('test')
self._if_make_target_execute('check')
elif self.generator == 'Ninja': elif self.generator == 'Ninja':
self._if_ninja_target_execute('test') self._if_ninja_target_execute('test')
self._if_ninja_target_execute('check')
# Check that self.prefix is there after installation # Check that self.prefix is there after installation
run_after('install')(PackageBase.sanity_check_prefix) run_after('install')(PackageBase.sanity_check_prefix)

View file

@ -46,7 +46,7 @@ class PyPybind11(CMakePackage):
version('2.1.1', '5518988698df937ccee53fb6ba91d12a') version('2.1.1', '5518988698df937ccee53fb6ba91d12a')
version('2.1.0', '3cf07043d677d200720c928569635e12') version('2.1.0', '3cf07043d677d200720c928569635e12')
depends_on('py-pytest', type=('build')) depends_on('py-pytest', type='test')
extends('python') extends('python')
@ -59,4 +59,8 @@ def cmake_args(self):
args = [] args = []
args.append('-DPYTHON_EXECUTABLE:FILEPATH=%s' args.append('-DPYTHON_EXECUTABLE:FILEPATH=%s'
% self.spec['python'].command.path) % self.spec['python'].command.path)
args += [
'-DPYBIND11_TEST:BOOL={0}'.format(
'ON' if self.run_tests else 'OFF')
]
return args return args