testing.globalipapp — IPython 0.11 documentation

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# testing.globalipapp

## Module: `testing.globalipapp`

Inheritance diagram for `IPython.testing.globalipapp`:

Global IPython app to support test running.

We must start our own ipython object and heavily muck with it so that all the modifications IPython makes to system behavior don’t send the doctest machinery into a fit. This code should be considered a gross hack, but it gets the job done.

## Classes

### `StreamProxy`

class `IPython.testing.globalipapp.``StreamProxy`(name)

  Bases: `IPython.utils.io.IOStream`

  Proxy for sys.stdout/err. This will request the stream at call time allowing for nose’s Capture plugin’s redirection of sys.stdout/err.

  Parameters : | name : str The name of the stream. This will be requested anew at every call

  `__init__`(name)
  `close`()
  `closed`
  `flush`()
  `stream`
  `write`(data)
  `writelines`(lines)

### `ipnsdict`

class `IPython.testing.globalipapp.``ipnsdict`(*a)

  Bases: `dict`

  A special subclass of dict for use as an IPython namespace in doctests.

  This subclass adds a simple checkpointing capability so that when testing machinery clears it (we use it as the test execution context), it doesn’t get completely destroyed.

  In addition, it can handle the presence of the ‘_’ key in a special manner, which is needed because of how Python’s doctest machinery operates with ‘_’. See constructor and `update()` for details.

  `__init__`(*a)
  `clear`()
  `copy`

    D.copy() -> a shallow copy of D

  static `fromkeys`(S[, v]) → New dict with keys from S and values equal to v.

    v defaults to None.

  `get`

    D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.

  `has_key`

    D.has_key(k) -> True if D has a key k, else False

  `items`

    D.items() -> list of D’s (key, value) pairs, as 2-tuples

  `iteritems`

    D.iteritems() -> an iterator over the (key, value) items of D

  `iterkeys`

    D.iterkeys() -> an iterator over the keys of D

  `itervalues`

    D.itervalues() -> an iterator over the values of D

  `keys`

    D.keys() -> list of D’s keys

  `pop`

    D.pop(k[,d]) -> v, remove specified key and return the corresponding value. If key is not found, d is returned if given, otherwise KeyError is raised

  `popitem`

    D.popitem() -> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.

  `setdefault`

    D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D

  `update`(other)
  `values`

    D.values() -> list of D’s values

### `py_file_finder`

class `IPython.testing.globalipapp.``py_file_finder`(test_filename)

  Bases: `object`

  `__init__`(test_filename)

## Functions

`IPython.testing.globalipapp.``get_ipython`()

`IPython.testing.globalipapp.``start_ipython`()

  Start a global IPython shell, which we need for IPython-specific syntax.

`IPython.testing.globalipapp.``xsys`(self, cmd)

  Replace the default system call with a capturing one for doctest.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »