1. 05 Sep, 2016 4 commits
  2. 04 Sep, 2016 7 commits
  3. 03 Sep, 2016 1 commit
    • Jason Rhinelander's avatar
      Make test initialization self-registering · 52f4be89
      Jason Rhinelander authored
      Adding or removing tests is a little bit cumbersome currently: the test
      needs to be added to CMakeLists.txt, the init function needs to be
      predeclared in pybind11_tests.cpp, then called in the plugin
      initialization.  While this isn't a big deal for tests that are being
      committed, it's more of a hassle when working on some new feature or
      test code for which I temporarily only care about building and linking
      the test being worked on rather than the entire test suite.
      
      This commit changes tests to self-register their initialization by
      having each test initialize a local object (which stores the
      initialization function in a static variable).  This makes changing the
      set of tests being build easy: one only needs to add or comment out
      test names in tests/CMakeLists.txt.
      
      A couple other minor changes that go along with this:
      
      - test_eigen.cpp is now included in the test list, then removed if eigen
        isn't available.  This lets you disable the eigen tests by commenting
        it out, just like all the other tests, but keeps the build working
        without eigen eigen isn't available.  (Also, if it's commented out, we
        don't even bother looking for and reporting the building with/without
        eigen status message).
      
      - pytest is now invoked with all the built test names (with .cpp changed
        to .py) so that it doesn't try to run tests that weren't built.
      52f4be89
  4. 02 Sep, 2016 4 commits
  5. 30 Aug, 2016 3 commits
  6. 29 Aug, 2016 6 commits
    • Jason Rhinelander's avatar
      Fix template trampoline overload lookup failure · 20978263
      Jason Rhinelander authored
      Problem
      =======
      
      The template trampoline pattern documented in PR #322 has a problem with
      virtual method overloads in intermediate classes in the inheritance
      chain between the trampoline class and the base class.
      
      For example, consider the following inheritance structure, where `B` is
      the actual class, `PyB<B>` is the trampoline class, and `PyA<B>` is an
      intermediate class adding A's methods into the trampoline:
      
          PyB<B> -> PyA<B> -> B -> A
      
      Suppose PyA<B> has a method `some_method()` with a PYBIND11_OVERLOAD in
      it to overload the virtual `A::some_method()`.  If a Python class `C` is
      defined that inherits from the pybind11-registered `B` and tries to
      provide an overriding `some_method()`, the PYBIND11_OVERLOADs declared
      in PyA<B> fails to find this overloaded method, and thus never invoke it
      (or, if pure virtual and not overridden in PyB<B>, raises an exception).
      
      This happens because the base (internal) `PYBIND11_OVERLOAD_INT` macro
      simply calls `get_overload(this, name)`; `get_overload()` then uses the
      inferred type of `this` to do a type lookup in `registered_types_cpp`.
      This is where it fails: `this` will be a `PyA<B> *`, but `PyA<B>` is
      neither the base type (`B`) nor the trampoline type (`PyB<B>`).  As a
      result, the overload fails and we get a failed overload lookup.
      
      The fix
      =======
      
      The fix is relatively simple: we can cast `this` passed to
      `get_overload()` to a `const B *`, which lets get_overload look up the
      correct class.  Since trampoline classes should be derived from `B`
      classes anyway, this cast should be perfectly safe.
      
      This does require adding the class name as an argument to the
      PYBIND11_OVERLOAD_INT macro, but leaves the public macro signatures
      unchanged.
      20978263
    • Jason Rhinelander's avatar
      Fix check-style exit status · 5a3570c4
      Jason Rhinelander authored
      The check-style exit status wasn't being propagated properly because
      the loops were running in a subshell (and so the change the the
      `errors` variable wasn't in the active command shell).  This fixes it
      by running the greps in subshells and the loops in the main shell.
      
      This also avoids the if(/for(/while( style check on
      tests/CMakeLists.txt, since it *does* have if() statements with no space
      that are producing error messages, but that is (acceptable) CMake style.
      5a3570c4
    • Wenzel Jakob's avatar
      Merge pull request #371 from jagerman/overload-name-doc-fix · d9b3db3e
      Wenzel Jakob authored
      Doc fix for OVERLOAD*_NAME macros
      d9b3db3e
    • Jason Rhinelander's avatar
      Doc fix for OVERLOAD*_NAME macros · 64830e33
      Jason Rhinelander authored
      The documentation says the string-valued python function name goes
      after the C++ function, but it actually goes before it.
      64830e33
    • Wenzel Jakob's avatar
      Merge pull request #369 from jagerman/check-for-tabs · 7946715d
      Wenzel Jakob authored
      Check for style issues during docs build
      7946715d
    • Wenzel Jakob's avatar
      Merge pull request #370 from jagerman/contributing-test-target · 5d1d380e
      Wenzel Jakob authored
      Minor doc fix: ``make test`` -> ``make pytest``
      5d1d380e
  7. 28 Aug, 2016 6 commits
  8. 27 Aug, 2016 5 commits
  9. 26 Aug, 2016 4 commits
    • Jason Rhinelander's avatar
      Don't install pytest from cmake, just fail instead · dd3d56a8
      Jason Rhinelander authored
      Installing something outside the project directory from a cmake
      invocation is overly intrusive; this changes tests/CMakeLists.txt to
      just fail with an informative message instead, and changes the
      travis-ci builds to install pytest via pip or apt-get.
      dd3d56a8
    • Wenzel Jakob's avatar
      minor Intel compiler fix · 324c9c52
      Wenzel Jakob authored
      324c9c52
    • Wenzel Jakob's avatar
      Merge pull request #361 from dean0x7d/barebones · c7c7705f
      Wenzel Jakob authored
      Test absence of optional dependencies and CMake automatic discovery functions
      c7c7705f
    • Dean Moldovan's avatar
      Fix Travis cache config: remove ccache, add OS X pip cache · 14bd10d6
      Dean Moldovan authored
      ccache on Travis was never configured properly so the setting never
      actually did anything. Enabling ccache for real brings other issues:
      due to the way the preprocessor is handled, some of the Python header
      macros produce bogus compiler warnings (which in turn produce errors
      with -Werror). ccache also requires additional configuration on OS X
      and docker. It would reduce compile time by ~30 seconds at best, so
      it's not worth the trouble.
      
      [skip appveyor]
      14bd10d6