Commit Graph

924 Commits

Author SHA1 Message Date
Wenzel Jakob bf099587cd documentation clarifications (fixes #346) 2016-08-22 12:52:02 +02:00
Dean Moldovan 99dbdc16e5 Simplify more tests by replacing capture with assert 2016-08-19 16:31:48 +02:00
Dean Moldovan 3b44daedf6 Rewrite eval tests to allow for simple asserts
Most of the test code is left in C++ since this is the
intended use case for the eval functions.
2016-08-19 16:31:48 +02:00
Dean Moldovan ec0d38ef25 Update the docs to reflect the new test structure
Test compilation instructions for Windows were changed to use the
`cmake --build` command line invocation which should be easier than
manually setting up using the CMake GUI and Visual Studio.
2016-08-19 13:32:01 +02:00
Dean Moldovan 18319d5598 Automatically install pytest from CMake
Pytest is a development dependency but we can make it painless by
automating the install using CMake.
2016-08-19 13:32:01 +02:00
Dean Moldovan a9a37b4e31 Move enum tests into a new file
There are more enum tests than 'constants and functions'.
2016-08-19 13:19:38 +02:00
Dean Moldovan 382db5b2e7 Move inheritance tests into the proper file 2016-08-19 13:19:38 +02:00
Dean Moldovan 665e8804f3 Simplify tests by replacing output capture with asserts where possible
The C++ part of the test code is modified to achieve this. As a result,
this kind of test:

```python
with capture:
    kw_func1(5, y=10)
assert capture == "kw_func(x=5, y=10)"
```

can be replaced with a simple:

`assert kw_func1(5, y=10) == "x=5, y=10"`
2016-08-19 13:19:38 +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
Wenzel Jakob 192eb88475 ..mention in benchmark docs as well 2016-08-19 09:38:14 +02:00
Wenzel Jakob 68b193e3f2 mention pyrosetta stats 2016-08-19 09:32:58 +02:00
Wenzel Jakob 8de0437e46 type_caster<std::function>: allow None values in both directions 2016-08-18 11:18:12 +02:00
Wenzel Jakob 0b63231bae minor doc touchups 2016-08-18 10:58:21 +02:00
Wenzel Jakob 1fa7422284 Merge pull request #341 from GlenWalker/keep_alive_no_nurse
Support keep_alive where nurse may be None
2016-08-18 10:50:31 +02:00
Wenzel Jakob 3460fccbd7 Merge pull request #345 from jagerman/travis-ci-dedicated-doc-build
Build docs just once, in a dedicated build
2016-08-18 10:48:34 +02:00
Glen Walker f45bb585c3 Support keep_alive where nurse may be None
For example keep_alive<0,1>() should work where the return value may sometimes be None. At present a "Could not allocate weak reference!" exception is thrown.
Update documentation to clarify behaviour of keep_alive when nurse is None or does not support weak references.
2016-08-18 09:09:41 +12:00
Jason Rhinelander 0b952cdf28 pip/venv in `before_install`; override `install` for docs build
Rather than adding an `if [ -n "$DOCS" ]` as a separate install
instruction, this simplifies the travis-ci logic to do the pip/venv
setup in the `before_install` hook, leaving the install hook to just
install the needed packages.

This makes the default install script simpler: it doesn't need to check
NATIVE_DEPS or DOCS because both of those now override `install`
anyway, so the top-level `install` is really just the install for the
gcc-4.8 and osx builds; the docker builds and docs build override
install completely.
2016-08-17 14:19:08 -04:00
Jason Rhinelander 4b5058dc2e Build docs just once, in a dedicated build
This switches the travis-ci build to build the docs in a dedicated
build rather than as part of the regular linux/osx builds.
2016-08-17 09:46:04 -04:00
Wenzel Jakob 4be2f990c0 Merge pull request #344 from jagerman/travis-ci-build-docs
Build sphinx docs (with -W) during travis-ci builds
2016-08-17 10:17:32 +02:00
Jason Rhinelander 7e016366fe Build sphinx docs with -W during travis-ci builds 2016-08-16 22:46:37 -04:00
Wenzel Jakob e357ed3cc8 Merge pull request #339 from dean0x7d/docfix
Fix sphinx doc missing code blocks and warnings
2016-08-16 02:02:17 +02:00
Dean Moldovan aebca12bb9 Fix sphinx doc missing code blocks and warnings
The missing empty line after `.. code-block::` resulted in incorrectly
parsed restructuredtext (sphinx warnings) and the code blocks were not
generated in the html output.

The `exclude_patterns` change just silences the orphaned file warning.

[ci skip]
2016-08-16 01:30:58 +02:00
Wenzel Jakob 94f2052d08 Merge pull request #335 from aldanor/bugfix/is_pod_struct
Decay types before passing to is_pod_struct<> / npy_format_descriptor<>
2016-08-15 20:12:06 +02:00
Ivan Smirnov 6956b655f0 Simplify code in eigen.h using new array ctors 2016-08-15 18:41:54 +01:00
Ivan Smirnov 67b3daeea4 Always decay type param of npy_format_descriptor 2016-08-15 18:41:54 +01:00
Ivan Smirnov edbd4cb0a7 Decay const qualifiers in is_pod_struct<> 2016-08-15 18:41:54 +01:00
Wenzel Jakob 6ecb5b1583 Merge pull request #337 from dean0x7d/werror
Report warnings as errors on Travis and AppVeyor (-Werror)
2016-08-15 14:19:01 +02:00
Dean Moldovan 9d52796a08 Fix "_POSIX_C_SOURCE" redefined warning on Python 2.7 2016-08-15 13:49:34 +02:00
Dean Moldovan 00a300950b Report warnings as errors on Travis and AppVeyor 2016-08-15 13:41:44 +02:00
Wenzel Jakob 91bdcf3acd Merge pull request #336 from jagerman/gcc6-testing
Add g++-6 builds to travis-ci
2016-08-15 06:47:38 +02:00
Wenzel Jakob 6a0a850742 Merge pull request #334 from aldanor/bugfix/string-descriptors
Fix format descriptors for string types
2016-08-15 06:47:13 +02:00
Jason Rhinelander 024ce4471b Add g++-6 builds to travis-ci
The current linux/g++ testing (using a backported g++-4.8 on a
4-year-old Ubuntu) is quite ancient.  It's good as a baseline level of
support, but it means we aren't testing g++'s C++14 support at all
(which is why #334 happened).

This commit adds a docker-based travis-ci build using the debian
"testing" distribution, which will give us both another test system
(with different versions of build tools), while, more importantly, also
adding a build and test run using g++ in C++14 mode.
2016-08-14 22:32:30 -04:00
Ivan Smirnov 03fb488579 format_descriptor::format() now yields std::string
This is required since format descriptors for string types that
were using PYBIND11_DESCR were causing problems on C++14 on Linux.

Although this is technically a breaking change, it shouldn't cause
problems since the only use of format strings is passing them to
buffer_info constructor which expects std::string.

Note: for non-structured types, the const char * value is still
accessible via ::value for compatibility purpose.
2016-08-15 00:40:29 +01:00
Wenzel Jakob 6fc7a30211 Merge pull request #333 from aldanor/feature/print
Add handle::repr() method
2016-08-14 14:46:13 +02:00
Ivan Smirnov 6715736936 Add handle::repr() method 2016-08-14 13:43:31 +01:00
Wenzel Jakob 3c3533b4bc Merge pull request #308 from aldanor/recarray
py::dtype, buffer protocol improvements, structured types support
2016-08-13 22:21:46 +02:00
Ivan Smirnov bccbc10a65 Update changelog and authors 2016-08-13 21:17:26 +01:00
Ivan Smirnov 7dcbfe228e Add a missing bytes ctor from const char * 2016-08-13 20:00:15 +01:00
Ivan Smirnov c22fe428ed Change str/bytes cast operators to ctors 2016-08-13 19:39:11 +01:00
Ivan Smirnov 89ec7f3e79 Add (const char *, size_t) ctors for str/bytes 2016-08-13 19:38:50 +01:00
Ivan Smirnov 1e1217817b Use explicit casts in str/bytes tests 2016-08-13 18:52:39 +01:00
Ivan Smirnov fd6cede7e9 Avoid extra allocations in operator str/bytes 2016-08-13 15:46:46 +01:00
Ivan Smirnov 35c51c477b A more strict bytes/str test 2016-08-13 13:52:27 +01:00
Ivan Smirnov b65185906d Update the docs to use the new array ctor 2016-08-13 13:28:56 +01:00
Ivan Smirnov 245f77b4d5 Use uint64_t instead of long in numpy tests (MSVC) 2016-08-13 13:20:36 +01:00
Ivan Smirnov f36ec97827 Fix MSVC warnings in numpy example 2016-08-13 13:14:51 +01:00
Ivan Smirnov 0d7a015fb4 Update numpy docstring test to the new format 2016-08-13 12:56:51 +01:00
Ivan Smirnov 4611bcdd36 Fix rebasing problems in example-python-types 2016-08-13 12:55:35 +01:00
Ivan Smirnov 61e3b0bd15 Use builtin str type for recarray field names 2016-08-13 12:51:31 +01:00
Ivan Smirnov 1cdd171fbc Add PYBIND11_STR_TYPE to represent builtin `str` 2016-08-13 12:51:31 +01:00