
=======================================================
                  F2PY unit testing site
=======================================================

.. Contents::

Tests
-----

* To run all F2PY unit tests in one command::

    cd tests
    python run_all.py [<options>]

  For example::

    localhost:~/src_cvs/f2py2e/tests$ python2.2 run_all.py 100 --quiet
    **********************************************
    Running '/usr/bin/python2.2 f77/return_integer.py 100 --quiet'
    run 1000 tests in 1.87 seconds
    initial virtual memory size: 3952640 bytes
    current virtual memory size: 3952640 bytes
    ok
    **********************************************
    Running '/usr/bin/python2.2 f77/return_logical.py 100 --quiet'
    run 1000 tests in 1.47 seconds
    initial virtual memory size: 3952640 bytes
    current virtual memory size: 3952640 bytes
    ok
    ...

  If some tests fail, try to run the failing tests separately (without
  the ``--quiet`` option) as described below to get more information
  about the failure.

* Test intent(in), intent(out) scalar arguments,
  scalars returned by F77 functions 
  and F90 module functions::

    tests/f77/return_integer.py
    tests/f77/return_real.py
    tests/f77/return_logical.py
    tests/f77/return_complex.py
    tests/f77/return_character.py
    tests/f90/return_integer.py
    tests/f90/return_real.py
    tests/f90/return_logical.py
    tests/f90/return_complex.py
    tests/f90/return_character.py

  Change to tests/ directory and run::

    python f77/return_<type>.py [<options>]
    python f90/return_<type>.py [<options>]

  where ``<type>`` is integer, real, logical, complex, or character.
  Test scripts options are described below.

  A test is considered succesful if the last printed line is "ok".

  If you get import errors like::

    ImportError: No module named f77_ext_return_integer

  but ``f77_ext_return_integer.so`` exists in the current directory then
  it means that the current directory is not included in to `sys.path`
  in your Python installation. As a fix, prepend ``.`` to ``PYTHONPATH``
  environment variable and rerun the tests. For example::

    PYTHONPATH=. python f77/return_integer.py

* Test mixing Fortran 77, Fortran 90 fixed and free format codes::

    tests/mixed/run.py

* Test basic callback hooks::

    tests/f77/callback.py

Options
-------

You may want to use the following options when running the test
scripts:

``<integer>``
  Run tests ``<integer>`` times. Useful for detecting memory leaks.  Under
  Linux tests scripts output virtual memory size state of the process
  before and after calling the wrapped functions.

``--quiet``
  Suppress all messages. On success only "ok" should be displayed.

``--fcompiler=<Gnu|Intel|...>``
  Use::

    f2py -c --help-fcompiler

  to find out what compilers are available (or more precisely, which
  ones are recognized by ``numpy_distutils``).

Reporting failures
------------------

XXX: (1) make sure that failures are due to f2py and (2) send full
stdout/stderr messages to me. Also add compiler,python,platform
information.
