Commit Graph

24 Commits

Author SHA1 Message Date
Dean Moldovan
7918bcc95b Add support for boost::variant in C++11 mode
In C++11 mode, `boost::apply_visitor` requires an explicit `result_type`.
This also adds optional tests for `boost::variant` in C++11/14, if boost
is available. In C++17 mode, `std::variant` is tested instead.
2017-08-12 21:27:44 +02:00
Dean Moldovan
9693a5c78f Add Catch framework for testing embedding support and C++-side features
At this point, there is only a single test for interpreter basics.

Apart from embedding itself, having a C++ test framework will also
benefit the C++-side features by allowing them to be tested directly.
2017-05-28 02:12:24 +02:00
Jason Rhinelander
77710ff01c Make PYBIND11_CPP_STANDARD work under MSVC
Under MSVC we were ignoring PYBIND11_CPP_STANDARD and simply not
passing any standard (which makes MSVC default to its C++14 mode).

MSVC 2015u3 added the `/std:c++14` and `/std:c++latest` flags; the
latter, under MSVC 2017, enables some C++17 features (such as
`std::optional` and `std::variant`), so it is something we need to
start supporting under MSVC.

This makes the PYBIND11_CPP_STANDARD cmake variable work under MSVC,
defaulting it to /std:c++14 (matching the default -std=c++14 for
non-MSVC).

It also adds a new appveyor test running under MSVC 2017 with
/std:c++latest, which runs (and passes) the
`std::optional`/`std::variant` tests.

Also updated the documentation to clarify the c++ flags and add show
MSVC flag examples.
2017-05-09 16:41:47 -04:00
Jason Rhinelander
b4cbd7a1fe Appveyor: Disable fast_finish for now
While builds are randomly failing, fast_finish is counterproductive.

Will reenable this once appveyor stabilizes.
2017-04-17 11:57:46 -04:00
Wenzel Jakob
46469d4ec3 AppVeyor: suppress debug messages about generate.stamp
(https://gitlab.kitware.com/cmake/cmake/issues/16783)
2017-04-11 03:01:52 +02:00
Jason Rhinelander
3983a8ed48 AppVeyor: Update eigen to 3.3.3
The 3.3.2 changelog indicates it has some VS 2017 fixes.  Updating to
see if that avoids the random build failures.
2017-04-10 14:48:24 -04:00
Jason Rhinelander
4c72ec2220 Appveyor: Remove /m to attempt to resolve build failures
/m also doesn't seem to have made the builds any faster.
2017-04-09 08:12:17 -04:00
Jason Rhinelander
087b8d84e9 Skip VS2015/x86 builds
AppVeyor just added support for excluding specific jobs; thhis commit
cuts the number of builds down to 6 from 8 by eliminating the VS2015 x86
builds.
2017-04-05 20:17:25 -04:00
Wenzel Jakob
8f010cce8e AppVeyor: use parallel builds
My group now has a subscription to AppVeyor pro, which also permits
running parallel builds on the open source projects.
2017-04-05 17:02:37 +02:00
Jason Rhinelander
cabbf610a7 Add VS 2017 build, and bump conda to 3.6
This adds VS 2017 to the build matrix, plus various other small
appveyor build changes:

- conda version bumped from 3.5 to 3.6
- build newer versions/architectures/python first (i.e. VS2017/x64/3.6
  is the first build, VS2015/x86/2.7 is the last)
- stop building after a job failure: often a build failure in one
  occurs everywhere; this just stops processing jobs (freeing them up
  for other PRs) if an error is hit.

Annoyingly, appveyor doesn't allow excluding tests: i.e. the test matrix
is always dense (appveyor issue 386), so for now we'll just run
everything.  (Once appveyor issue 386 is resolved, we can come back and
cut this down to 4-5 builds).
2017-03-17 14:47:51 +01:00
Dean Moldovan
b0f3885c95 Make sure add_subdirectory and find_package behave identically
Add a BUILD_INTERFACE and a pybind11::pybind11 alias for the interface
library to match the installed target.

Add new cmake tests for add_subdirectory and consolidates the
.cpp and .py files needed for the cmake build tests:

Before:
tests
|-- test_installed_module
|   |-- CMakeLists.txt
|   |-- main.cpp
|   \-- test.py
\-- test_installed_target
    |-- CMakeLists.txt
    |-- main.cpp
    \-- test.py

After:
tests
\-- test_cmake_build
    |-- installed_module/CMakeLists.txt
    |-- installed_target/CMakeLists.txt
    |-- subdirectory_module/CMakeLists.txt
    |-- subdirectory_target/CMakeLists.txt
    |-- main.cpp
    \-- test.py
2016-12-19 16:34:48 +01:00
Lori A. Burns
eb09af5e58 test installed pybind 2016-12-13 21:44:19 +01:00
Jason Rhinelander
219b10ac99 Update travis and appveyor builds to eigen 3.3.0 (#491) 2016-11-11 16:15:38 +09:00
Dean Moldovan
81511be341 Replace std::cout with py::print in tests
With this change both C++ and Python write to sys.stdout which resolves
the capture issues noted in #351. Therefore, the related workarounds are
removed.
2016-09-07 01:25:27 +02:00
Dean Moldovan
b6ccdc953d Workaround for random failure of pytest capture on Windows
pytest can capture test output both globally (controlled by the cmd line
flag --capture) or locally (`capsys` and `capfd` fixtures). Enabling both
methods at the same time causes problems on Windows: test output is not
captured sometimes, resulting in test failure. This happens seemingly at
random.

This workaround disables global output capture ("-s", i.e. "--capture=no")
leaving only the local capture fixtures. As a side-effect test output on
AppVeyor CI is a little messy, but this will have to do until a better
solution is found.
2016-08-23 01:09:52 +02:00
Dean Moldovan
a0c1ccf0a9 Port tests to pytest
Use simple asserts and pytest's powerful introspection to make testing
simpler. This merges the old .py/.ref file pairs into simple .py files
where the expected values are right next to the code being tested.

This commit does not touch the C++ part of the code and replicates the
Python tests exactly like the old .ref-file-based approach.
2016-08-19 13:19:38 +02:00
Dean Moldovan
00a300950b Report warnings as errors on Travis and AppVeyor 2016-08-15 13:41:44 +02:00
Dean Moldovan
3ac1275248 Improve CI test coverage: eigen, numpy and C++14 2016-07-30 17:18:33 +02:00
Wenzel Jakob
464c43513e further eval() improvements 2016-07-08 15:08:30 +02:00
Wenzel Jakob
5130212d5f appveyor: show output on test failure 2016-07-08 14:03:54 +02:00
Dean Moldovan
52ae7b1d33 Add 'check' target which both builds and tests 2016-06-02 09:05:15 +02:00
Huu Nguyen
665eeafd44 Add debug appveyor configuration 2015-12-12 23:03:30 -05:00
Wenzel Jakob
42af9c295a appveyor: legacy build on win32 2015-10-23 10:25:47 +02:00
Wenzel Jakob
fab881caf4 appveyor CI script 2015-10-18 18:01:33 +02:00