12. cmdtools
— pyFormex command line tools¶
This module contains some command line tools that are run through the pyformex command, but do not start a full pyFormex program: just execute some small task and exit.
Furthermore it contains some functions for handling the user preferences.
12.1. Classes defined in module cmdtools¶
12.2. Functions defined in module cmdtools¶
- cmdtools.remove_pyFormex(pyformexdir, executable)[source]¶
Remove the pyFormex installation.
This will remove a pyFormex installation that was done using the ‘python setup.py install’ command from a source distribution in ‘tar’gz’ format. The procedure is interactive and will ask for confirmation.
- Parameters:
Notes
This implements the pyformex –remove functionality.
- cmdtools.list_modules(pkgs=['all'])[source]¶
Return the list of pure Python modules in a pyFormex subpackage.
- Parameters:
A list of pyFormex subpackage names. The subpackage name is a subdirectory of the main pyformex package directory. Two special package names are recognized:
’core’: returns the modules in the top level pyformex package
’all’: returns all pyFormex modules
An empty list is interpreted as [‘all’].
- Returns:
list of str – A list of all modules in the specified packages.
Notes
This implements the
pyformex --listmodules
functionality.
- cmdtools.run_pytest(modules)[source]¶
Run the pytests for the specified pyFormex modules.
- Parameters:
modules (list of str) – A list of pyFormex modules in dotted Python notation, relative to the pyFormex package. If an empty list is supplied, all available pytests will be run.
Notes
Test modules are stored under the path pf.cfg[‘testdir’], with the same hierarchy as the pyFormex source modules, and are named test_MODULE.py, where MODULE is the corresponding source module.
This implements the pyformex –pytest functionality.
- cmdtools.run_doctest(modules)[source]¶
Run the doctests for the specified pyFormex modules.
- Parameters:
modules (list of str) – A list of pyFormex modules in dotted Python notation, relative to the pyFormex package. If an empty list is supplied, all doctests in all pyFormex modules will be run.
Notes
Doctests are tests embedded in the docstrings of the Python source.
To allow consistent output of floats independent of machine precision, numpy’s floating point print precision is set to two decimals.
This implements the pyformex –doctest functionality.