mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-31 03:33:13 +08:00
Merge pull request #220 from dean0x7d/fixes
A few smaller fixes and a test output improvement
This commit is contained in:
commit
a22ce6cb0e
@ -19,8 +19,6 @@ install:
|
|||||||
build_script:
|
build_script:
|
||||||
- echo Running cmake...
|
- echo Running cmake...
|
||||||
- cd c:\projects\pybind11
|
- cd c:\projects\pybind11
|
||||||
- cmake -G "%CMAKE_PLATFORM%" -DPYTHON_INCLUDE_DIR:PATH=%PYTHON_DIR%/include -DPYTHON_LIBRARY:FILEPATH=%PYTHON_DIR%/libs/python34.lib -DPYTHON_EXECUTABLE:FILEPATH=%PYTHON_DIR%/python.exe
|
- cmake -G "%CMAKE_PLATFORM%" -DPYTHON_EXECUTABLE:FILEPATH=%PYTHON_DIR%/python.exe
|
||||||
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
- set MSBuildLogger="C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
|
||||||
- set MSBuildOptions=/v:m /p:Configuration=%Configuration% /logger:%MSBuildLogger%
|
- cmake --build . --config %Configuration% --target check -- /v:m /logger:%MSBuildLogger%
|
||||||
- msbuild %MSBuildOptions% pybind11.sln
|
|
||||||
- ctest -C %Configuration%
|
|
||||||
|
|||||||
12
.travis.yml
12
.travis.yml
@ -23,19 +23,19 @@ matrix:
|
|||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
compiler: gcc-4.8
|
compiler: gcc-4.8
|
||||||
script:
|
install:
|
||||||
- pyvenv-3.5 venv
|
- pyvenv-3.5 venv
|
||||||
- cmake -DPYBIND11_PYTHON_VERSION=3.5 -DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.5m -DPYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython3.5m.so -DPYTHON_EXECUTABLE:FILEPATH=`pwd`/venv/bin/python3.5 -DCMAKE_CXX_COMPILER=g++-4.8
|
|
||||||
- make -j 2
|
|
||||||
- source venv/bin/activate
|
- source venv/bin/activate
|
||||||
|
- pip install -U pip wheel
|
||||||
- pip install numpy
|
- pip install numpy
|
||||||
- CTEST_OUTPUT_ON_FAILURE=TRUE make test
|
script:
|
||||||
|
- CXX=g++-4.8 cmake -DPYBIND11_PYTHON_VERSION=3.5
|
||||||
|
- CTEST_OUTPUT_ON_FAILURE=TRUE make check -j 2
|
||||||
- os: osx
|
- os: osx
|
||||||
compiler: clang
|
compiler: clang
|
||||||
script:
|
script:
|
||||||
- cmake -DPYBIND11_PYTHON_VERSION=2.7
|
- cmake -DPYBIND11_PYTHON_VERSION=2.7
|
||||||
- make -j 2
|
- CTEST_OUTPUT_ON_FAILURE=TRUE make check -j 2
|
||||||
- CTEST_OUTPUT_ON_FAILURE=TRUE make test
|
|
||||||
#- os: linux
|
#- os: linux
|
||||||
#compiler: gcc-4.8
|
#compiler: gcc-4.8
|
||||||
#script:
|
#script:
|
||||||
|
|||||||
@ -145,6 +145,7 @@ endfunction()
|
|||||||
if (PYBIND11_TEST)
|
if (PYBIND11_TEST)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(example)
|
add_subdirectory(example)
|
||||||
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> DEPENDS example)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (PYBIND11_INSTALL)
|
if (PYBIND11_INSTALL)
|
||||||
|
|||||||
@ -154,7 +154,7 @@ void init_ex2(py::module &m) {
|
|||||||
.def("get_list", &Example2::get_list, "Return a Python list")
|
.def("get_list", &Example2::get_list, "Return a Python list")
|
||||||
.def("get_list_2", &Example2::get_list_2, "Return a C++ list")
|
.def("get_list_2", &Example2::get_list_2, "Return a C++ list")
|
||||||
.def("get_set", &Example2::get_set, "Return a Python set")
|
.def("get_set", &Example2::get_set, "Return a Python set")
|
||||||
.def("get_set2", &Example2::get_set, "Return a C++ set")
|
.def("get_set2", &Example2::get_set_2, "Return a C++ set")
|
||||||
.def("get_array", &Example2::get_array, "Return a C++ array")
|
.def("get_array", &Example2::get_array, "Return a C++ array")
|
||||||
.def("print_dict", &Example2::print_dict, "Print entries of a Python dictionary")
|
.def("print_dict", &Example2::print_dict, "Print entries of a Python dictionary")
|
||||||
.def("print_dict_2", &Example2::print_dict_2, "Print entries of a C++ dictionary")
|
.def("print_dict_2", &Example2::print_dict_2, "Print entries of a C++ dictionary")
|
||||||
|
|||||||
@ -135,7 +135,7 @@ void init_issues(py::module &m) {
|
|||||||
try {
|
try {
|
||||||
py::class_<Placeholder>(m2, "Placeholder");
|
py::class_<Placeholder>(m2, "Placeholder");
|
||||||
throw std::logic_error("Expected an exception!");
|
throw std::logic_error("Expected an exception!");
|
||||||
} catch (std::runtime_error &e) {
|
} catch (std::runtime_error &) {
|
||||||
/* All good */
|
/* All good */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import sys
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import difflib
|
||||||
|
|
||||||
remove_unicode_marker = re.compile(r'u(\'[^\']*\')')
|
remove_unicode_marker = re.compile(r'u(\'[^\']*\')')
|
||||||
remove_long_marker = re.compile(r'([0-9])L')
|
remove_long_marker = re.compile(r'([0-9])L')
|
||||||
@ -36,11 +37,7 @@ def sanitize(lines):
|
|||||||
line = ""
|
line = ""
|
||||||
lines[i] = line
|
lines[i] = line
|
||||||
|
|
||||||
lines = '\n'.join(sorted([l for l in lines if l != ""]))
|
return '\n'.join(sorted([l for l in lines if l != ""]))
|
||||||
|
|
||||||
print('==================')
|
|
||||||
print(lines)
|
|
||||||
return lines
|
|
||||||
|
|
||||||
path = os.path.dirname(__file__)
|
path = os.path.dirname(__file__)
|
||||||
if path != '':
|
if path != '':
|
||||||
@ -69,4 +66,8 @@ elif output == reference:
|
|||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
print('Test "%s" FAILED!' % name)
|
print('Test "%s" FAILED!' % name)
|
||||||
|
print('--- output')
|
||||||
|
print('+++ reference')
|
||||||
|
print(''.join(difflib.ndiff(output.splitlines(keepends=True),
|
||||||
|
reference.splitlines(keepends=True))))
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|||||||
@ -139,7 +139,7 @@ protected:
|
|||||||
const T *it = ptr;
|
const T *it = ptr;
|
||||||
while (*it++ != (T) 0)
|
while (*it++ != (T) 0)
|
||||||
;
|
;
|
||||||
return it - ptr;
|
return static_cast<size_t>(it - ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::type_info **m_types = nullptr;
|
const std::type_info **m_types = nullptr;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user