Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sa’im al-Dahr: Run Sphinx doctests with Nose

Sa’im al-Dahr: Run Sphinx doctests with Nose

Sa’im al-Dahr finds the missing nose of the Sphinx. Actually a Nose plugin that reads in Sphinx doctests, and run them as Nose test cases.

9dafad54b5b4f360b7aae5f482bc1c91?s=128

Tzu-ping Chung

February 26, 2015
Tweet

More Decks by Tzu-ping Chung

Other Decks in Programming

Transcript

  1. Sa’im al-Dahr

  2. The Great Sphinx of Giza

  3. None
  4. None
  5. None
  6. None
  7. Sphinx + Nose = ?

  8. Sa’im al-Dahr

  9. Why? • One-stop testing • Code in docs should be

    tested • Some tests shouldn’t be in docs
  10. pip  install  sphinx-­‐nose

  11. None
  12. None
  13. $  nosetests  -­‐-­‐with-­‐sphinx   ...............   -­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐-­‐   Ran  15

     tests  in  0.022s   OK
  14. import  nose   from  sphinxnose  import  SphinxDoctest   def  runtests():

           nose.run(                  argv=[                          __file__,                          '-­‐-­‐with-­‐sphinx',                          '-­‐-­‐sphinx-­‐doc-­‐dir=testdocs'                  ],                  plugins=[SphinxDoctest()],          )
  15. http://github.com/ uranusjr/saim-­‐al-­‐dahr

  16. WHAT IF I AM INTERESTED IN SOMETHING ELSE?