usage.rst 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. Basic usage
  2. -----------
  3. Use the nosetests script (after installation by setuptools)::
  4. nosetests [options] [(optional) test files or directories]
  5. In addition to passing command-line options, you may also put configuration
  6. options in a .noserc or nose.cfg file in your home directory. These are
  7. standard .ini-style config files. Put your nosetests configuration in a
  8. [nosetests] section, with the -- prefix removed::
  9. [nosetests]
  10. verbosity=3
  11. with-doctest=1
  12. There is also possiblity to disable configuration files loading (might be
  13. useful when runnig i.e. tox and you don't want your global nose config file to
  14. be used by tox). In order to ignore those configuration files simply set an
  15. environment variable ``NOSE_IGNORE_CONFIG_FILES``.
  16. There are several other ways to use the nose test runner besides the
  17. `nosetests` script. You may use nose in a test script::
  18. import nose
  19. nose.main()
  20. If you don't want the test script to exit with 0 on success and 1 on failure
  21. (like unittest.main), use nose.run() instead::
  22. import nose
  23. result = nose.run()
  24. `result` will be true if the test run succeeded, or false if any test failed
  25. or raised an uncaught exception. Lastly, you can run nose.core directly, which
  26. will run nose.main()::
  27. python /path/to/nose/core.py
  28. Please see the usage message for the nosetests script for information
  29. about how to control which tests nose runs, which plugins are loaded,
  30. and the test output.
  31. Extended usage
  32. ^^^^^^^^^^^^^^
  33. .. autohelp ::