text
stringlengths 0
79
|
|---|
=======================================================
|
Nose plugin with IPython and extension module support
|
=======================================================
|
This directory provides the key functionality for test support that IPython
|
needs as a nose plugin, which can be installed for use in projects other than
|
IPython.
|
The presence of a Makefile here is mostly for development and debugging
|
purposes as it only provides a few shorthand commands. You can manually
|
install the plugin by using standard Python procedures (``setup.py install``
|
with appropriate arguments).
|
To install the plugin using the Makefile, edit its first line to reflect where
|
you'd like the installation.
|
Once you've set the prefix, simply build/install the plugin with::
|
make
|
and run the tests with::
|
make test
|
You should see output similar to::
|
maqroll[plugin]> make test
|
nosetests -s --with-ipdoctest --doctest-tests dtexample.py
|
..
|
----------------------------------------------------------------------
|
Ran 2 tests in 0.016s
|
OK
|
=======================
|
Combo testing example
|
=======================
|
This is a simple example that mixes ipython doctests::
|
In [1]: import code
|
In [2]: 2**12
|
Out[2]: 4096
|
with command-line example information that does *not* get executed::
|
$ mpirun -n 4 ipengine --controller-port=10000 --controller-ip=host0
|
and with literal examples of Python source code::
|
controller = dict(host='myhost',
|
engine_port=None, # default is 10105
|
control_port=None,
|
)
|
# keys are hostnames, values are the number of engine on that host
|
engines = dict(node1=2,
|
node2=2,
|
node3=2,
|
node3=2,
|
)
|
# Force failure to detect that this test is being run.
|
1/0
|
These source code examples are executed but no output is compared at all. An
|
error or failure is reported only if an exception is raised.
|
NOTE: the execution of pure python blocks is not yet working!
|
=====================================
|
Tests in example form - pure python
|
=====================================
|
This file contains doctest examples embedded as code blocks, using normal
|
Python prompts. See the accompanying file for similar examples using IPython
|
prompts (you can't mix both types within one file). The following will be run
|
as a test::
|
>>> 1+1
|
2
|
>>> print ("hello")
|
hello
|
More than one example works::
|
>>> s="Hello World"
|
>>> s.upper()
|
'HELLO WORLD'
|
but you should note that the *entire* test file is considered to be a single
|
test. Individual code blocks that fail are printed separately as ``example
|
failures``, but the whole file is still counted and reported as one test.
|
=================================
|
Tests in example form - IPython
|
=================================
|
You can write text files with examples that use IPython prompts (as long as you
|
use the nose ipython doctest plugin), but you can not mix and match prompt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.