1. 06 Aug, 2021 1 commit
    • Aaron Gokaslan's avatar
      maint(clang-tidy): Bugprone enable checks (#3166) · 3893f37b
      Aaron Gokaslan authored
      * Enable bugprone checks
      
      * Reset delta and massage config
      
      * Start to apply bugprone fixes
      
      * try to fix minor bug
      
      * Fix later
      
      * Fix perfect forwarding bugprone
      
      * Remove nolint
      
      * undo constructor delete
      
      * Fix bugprone-perfect-forwarding again
      
      * Remove TODO
      
      * Add another nolint for bugprone-exception-escape in scoped interpreter
      
      * Fix remaining bugprone errors
      
      * Properly apply bugprone-macro-parantheses
      
      * Redo formatting and remove bugprone nolint
      
      * Add coment and revert more whitespace changes
      
      * Fix typo
      
      * Fix parsing bug
      
      * Add back comma
      
      * Fix clang-tidy issue
      
      * Apply remaining clang-tidy fixes
      3893f37b
  2. 14 Jul, 2021 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      * Removing stray semicolons (discovered by running clang-format v12 followed... · aca6c3ba
      Ralf W. Grosse-Kunstleve authored
      * Removing stray semicolons (discovered by running clang-format v12 followed by tools/check-style.sh). (#3087)
      
      * Manually moving `// NOLINT` comments so that clang-format does not move them to the wrong places.
      
      * Manually reformatting comments related to `static_assert`s so that clang-format does not need two passes.
      
      * Empty lines between #includes, to prevent clang-format from shuffling the order and thereby confusing MSVC 2015.
      
      * git diff -U0 --no-color HEAD^ | python3 $HOME/clone/llvm-project/clang/tools/clang-format/clang-format-diff.py -p1 -style=file -i
      aca6c3ba
  3. 12 Jul, 2021 1 commit
    • Ralf W. Grosse-Kunstleve's avatar
      NOLINT reduction (#3096) · 2d468697
      Ralf W. Grosse-Kunstleve authored
      * Copying from prework_no_rst branch (PR #3087): test_numpy_array.cpp, test_stl.cpp
      
      * Manual changes reducing NOLINTs.
      
      * clang-format-diff.py
      
      * Minor adjustment to avoid MSVC warning C4702: unreachable code
      2d468697
  4. 22 Jun, 2021 1 commit
    • Aaron Gokaslan's avatar
      fix(clang-tidy): performance fixes applied in tests and CI (#3051) · dac74ebd
      Aaron Gokaslan authored
      * Initial fixes
      
      * Whoops
      
      * Finish clang-tidy manual fixes
      
      * Add two missing fixes
      
      * Revert
      
      * Update clang-tidy
      
      * Try to fix unreachable code error
      
      * Move nolint comment
      
      * Apply missing fix
      
      * Don't override clang-tidy config
      
      * Does this fix clang-tidy?
      
      * Make all clang-tidy errors visible
      
      * Add comments about NOLINTs and remove a few
      
      * Fix typo
      dac74ebd
  5. 15 Oct, 2020 1 commit
  6. 03 Oct, 2020 1 commit
    • Fritz Reese's avatar
      Fix buffer_info for ctypes buffers (pybind#2502) (#2503) · e8ad33bb
      Fritz Reese authored
      * tests: New test for ctypes buffers (pybind#2502)
      
      * fix: fix buffer_info segfault on views with no stride (pybind11#2502)
      
      * Explicit conversions in buffer_info to make clang happy (pybind#2502)
      
      * Another explicit cast in buffer_info constructor for clang (pybind#2502)
      
      * Simpler implementation of buffer_info constructor from Py_buffer.
      
      * Move test_ctypes_buffer into test_buffers
      
      * Comment on why view->strides may be NULL (and fix some whitespace)
      
      * Use c_strides() instead of zero when view->strides is NULL.
      
      c_strides and f_strides are moved from numpy.h (py::array)
      to buffer_info.h (py::detail) so they can be used from the
      buffer_info Py_buffer constructor.
      
      * Increase ctypes buffer test coverage in test_buffers.
      
      * Split ctypes tests and skip one which is broken in PyPy2.
      e8ad33bb
  7. 24 Nov, 2019 1 commit
  8. 27 Aug, 2019 1 commit
  9. 21 Sep, 2017 1 commit
    • Ansgar Burchardt's avatar
      correct stride in matrix example and test · a22dd2d1
      Ansgar Burchardt authored
      This also matches the Eigen example for the row-major case.
      
      This also enhances one of the tests to trigger a failure (and fixes it in the PR).  (This isn't really a flaw in pybind itself, but rather fixes wrong code in the test code and docs).
      a22dd2d1
  10. 30 Aug, 2017 1 commit
  11. 05 Aug, 2017 1 commit
    • Jason Rhinelander's avatar
      Update all remaining tests to new test styles · 391c7544
      Jason Rhinelander authored
      This udpates all the remaining tests to the new test suite code and
      comment styles started in #898.  For the most part, the test coverage
      here is unchanged, with a few minor exceptions as noted below.
      
      - test_constants_and_functions: this adds more overload tests with
        overloads with different number of arguments for more comprehensive
        overload_cast testing.  The test style conversion broke the overload
        tests under MSVC 2015, prompting the additional tests while looking
        for a workaround.
      
      - test_eigen: this dropped the unused functions `get_cm_corners` and
        `get_cm_corners_const`--these same tests were duplicates of the same
        things provided (and used) via ReturnTester methods.
      
      - test_opaque_types: this test had a hidden dependence on ExampleMandA
        which is now fixed by using the global UserType which suffices for the
        relevant test.
      
      - test_methods_and_attributes: this required some additions to UserType
        to make it usable as a replacement for the test's previous SimpleType:
        UserType gained a value mutator, and the `value` property is not
        mutable (it was previously readonly).  Some overload tests were also
        added to better test overload_cast (as described above).
      
      - test_numpy_array: removed the untemplated mutate_data/mutate_data_t:
        the templated versions with an empty parameter pack expand to the same
        thing.
      
      - test_stl: this was already mostly in the new style; this just tweaks
        things a bit, localizing a class, and adding some missing
        `// test_whatever` comments.
      
      - test_virtual_functions: like `test_stl`, this was mostly in the new
        test style already, but needed some `// test_whatever` comments.
        This commit also moves the inherited virtual example code to the end
        of the file, after the main set of tests (since it is less important
        than the other tests, and rather length); it also got renamed to
        `test_inherited_virtuals` (from `test_inheriting_repeat`) because it
        tests both inherited virtual approaches, not just the repeat approach.
      391c7544
  12. 29 May, 2017 2 commits
  13. 22 May, 2017 1 commit
  14. 07 May, 2017 2 commits
  15. 16 Dec, 2016 1 commit
    • Wenzel Jakob's avatar
      WIP: PyPy support (#527) · 1d1f81b2
      Wenzel Jakob authored
      This commit includes modifications that are needed to get pybind11 to work with PyPy. The full test suite compiles and runs except for a last few functions that are commented out (due to problems in PyPy that were reported on the PyPy bugtracker).
      
      Two somewhat intrusive changes were needed to make it possible: two new tags ``py::buffer_protocol()`` and ``py::metaclass()`` must now be specified to the ``class_`` constructor if the class uses the buffer protocol and/or requires a metaclass (e.g. for static properties).
      
      Note that this is only for the PyPy version based on Python 2.7 for now. When the PyPy 3.x has caught up in terms of cpyext compliance, a PyPy 3.x patch will follow.
      1d1f81b2
  16. 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
  17. 19 Aug, 2016 1 commit
    • Dean Moldovan's avatar
      Port tests to pytest · a0c1ccf0
      Dean Moldovan authored
      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.
      a0c1ccf0
  18. 13 Aug, 2016 2 commits
  19. 11 Aug, 2016 1 commit
    • Jason Rhinelander's avatar
      Improve constructor/destructor tracking · 3f589379
      Jason Rhinelander authored
      This commit rewrites the examples that look for constructor/destructor
      calls to do so via static variable tracking rather than output parsing.
      
      The added ConstructorStats class provides methods to keep track of
      constructors and destructors, number of default/copy/move constructors,
      and number of copy/move assignments.  It also provides a mechanism for
      storing values (e.g. for value construction), and then allows all of
      this to be checked at the end of a test by getting the statistics for a
      C++ (or python mapping) class.
      
      By not relying on the precise pattern of constructions/destructions,
      but rather simply ensuring that every construction is matched with a
      destruction on the same object, we ensure that everything that gets
      created also gets destroyed as expected.
      
      This replaces all of the various "std::cout << whatever" code in
      constructors/destructors with
      `print_created(this)`/`print_destroyed(this)`/etc. functions which
      provide similar output, but now has a unified format across the
      different examples, including a new ### prefix that makes mixed example
      output and lifecycle events easier to distinguish.
      
      With this change, relaxed mode is no longer needed, which enables
      testing for proper destruction under MSVC, and under any other compiler
      that generates code calling extra constructors, or optimizes away any
      constructors.  GCC/clang are used as the baseline for move
      constructors; the tests are adapted to allow more move constructors to
      be evoked (but other types are constructors much have matching counts).
      
      This commit also disables output buffering of tests, as the buffering
      sometimes results in C++ output ending up in the middle of python
      output (or vice versa), depending on the OS/python version.
      3f589379
  20. 18 Jul, 2016 1 commit
    • Jason Rhinelander's avatar
      Rename examples files, as per #288 · b3f3d79f
      Jason Rhinelander authored
      This renames example files from `exampleN` to `example-description`.
      
      Specifically, the following renaming is applied:
      
      example1 -> example-methods-and-attributes
      example2 -> example-python-types
      example3 -> example-operator-overloading
      example4 -> example-constants-and-functions
      example5 -> example-callbacks (*)
      example6 -> example-sequence-and-iterators
      example7 -> example-buffers
      example8 -> example-custom-ref-counting
      example9 -> example-modules
      example10 -> example-numpy-vectorize
      example11 -> example-arg-keywords-and-defaults
      example12 -> example-virtual-functions
      example13 -> example-keep-alive
      example14 -> example-opaque-types
      example15 -> example-pickling
      example16 -> example-inheritance
      example17 -> example-stl-binders
      example18 -> example-eval
      example19 -> example-custom-exceptions
      
      * the inheritance parts of example5 are moved into example-inheritance
      (previously example16), and the remainder is left as example-callbacks.
      
      This commit also renames the internal variables ("Example1",
      "Example2", "Example4", etc.) into non-numeric names ("ExampleMandA",
      "ExamplePythonTypes", "ExampleWithEnum", etc.) to correspond to the
      file renaming.
      
      The order of tests is preserved, but this can easily be changed if
      there is some more natural ordering by updating the list in
      examples/CMakeLists.txt.
      b3f3d79f
  21. 04 May, 2016 1 commit
    • Wenzel Jakob's avatar
      redesigned format_descriptor<> and npy_format_descriptor<> · 876eeab4
      Wenzel Jakob authored
      This somewhat heavyweight solution will avoid size_t/long long/long/int
      mismatches on various platforms once and for all. The previous template
      overloads could e.g. not handle size_t on Darwin.
      
      One gotcha: the 'format_descriptor<T>::value()' syntax changed to just
      'format_descriptor<T>::value'
      876eeab4
  22. 18 Apr, 2016 1 commit
  23. 29 Jul, 2015 1 commit
  24. 09 Jul, 2015 1 commit