Commit Graph

2797 Commits

Author SHA1 Message Date
Wenzel Jakob
36919ea695 Merge pull request #364 from jagerman/cmake-remove-pip
Don't install pytest from cmake, just fail instead
2016-08-27 11:34:01 +02:00
Jason Rhinelander
dd3d56a885 Don't install pytest from cmake, just fail instead
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.
2016-08-26 17:22:48 -04:00
Wenzel Jakob
324c9c521b minor Intel compiler fix 2016-08-26 16:52:45 +02:00
Wenzel Jakob
c7c7705f86 Merge pull request #361 from dean0x7d/barebones
Test absence of optional dependencies and CMake automatic discovery functions
2016-08-26 12:34:38 +02:00
Dean Moldovan
14bd10d6d6 Fix Travis cache config: remove ccache, add OS X pip cache
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]
2016-08-26 11:53:25 +02:00
Dean Moldovan
b62a896f31 Add barebones build to Travis CI
This build makes sure everything still works without optional
dependencies (numpy/scipy/eigen) and also tests the automatic
discovery functions in CMake (Python version, C++ standard).

[skip appveyor]
2016-08-26 11:41:27 +02:00
Wenzel Jakob
7b748cef3b Merge pull request #359 from dean0x7d/fix_skip_numpy
Fix test suite failure without numpy and improve module init diagnostics
2016-08-26 09:53:44 +02:00
Wenzel Jakob
3c49bca67a Merge pull request #358 from aldanor/bugfix/icpc-numpy
Fix dtype::strip_padding() on Intel compiler
2016-08-25 22:56:38 +02:00
Ivan Smirnov
d8b11b8708 Fix dtype::strip_padding() on Intel compiler 2016-08-25 21:52:52 +01:00
Dean Moldovan
23919174a7 Fix test suite failure without numpy and improve module init diagnostics
Fixes #357.
2016-08-25 17:08:09 +02:00
Wenzel Jakob
69b6246677 add reason attribute to pytest.mark.skipif 2016-08-25 02:20:35 +02:00
Wenzel Jakob
9a777a263d numpy.h: fix test suite issues on the Intel Compiler 2016-08-25 02:18:00 +02:00
Wenzel Jakob
89f2db4596 Merge pull request #353 from aldanor/feature/generalized-iterators
Add support for iterators with different begin/end types
2016-08-25 01:47:38 +02:00
Wenzel Jakob
1ffce7422d Get pybind11 test suite to compile on the Intel compiler (more or less..)
- ICPC can't handle the NCVirt trampoline which returns a non-copyable
  type, which is likely due to a constexpr/SFINAE issue. This disables
  the test on that compiler so that at least the rest can be tested.
2016-08-25 01:43:35 +02:00
Wenzel Jakob
ce55683084 Merge pull request #354 from aldanor/bugfix/int_-shadow
Fix int_ shadowing problem in detail namespace
2016-08-25 01:40:53 +02:00
Ivan Smirnov
1c8828fe8f Fix int_ shadowing problem in detail namespace
If operators.h is included, int_ function in the `detail`
namespace will shadow pybind11::int_ type, so the fully qualified
name has to be used.
2016-08-25 00:33:02 +01:00
Ivan Smirnov
606160ed68 Update the changelog re: generalized iterators 2016-08-24 23:32:13 +01:00
Ivan Smirnov
4c5e21b0cb Add tests for generalized iterators 2016-08-24 23:30:00 +01:00
Ivan Smirnov
2b308e01f7 Add support for iterators with differing end type 2016-08-24 23:29:04 +01:00
Ivan Smirnov
c5a1c8a6b9 Don't require operator-> for key iterators 2016-08-24 23:27:19 +01:00
Wenzel Jakob
b692896fc7 Merge pull request #351 from dean0x7d/fix-win-test-capture
Workaround for random failure of pytest capture on Windows
2016-08-23 01:27:36 +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
Wenzel Jakob
faec30c4db Merge pull request #321 from dean0x7d/pytest
Port test suite to pytest
2016-08-22 13:02:27 +02:00
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