2

I like to keep in docstring of a Python script rna_filter.py usage like:

Usage::

  $ python rna_filter.py -r restraints.txt -s test_data/CG.pdb -v
  (d:A1-A2 <  10.0  1)|(d:A2-A1 <= 10 1)
  restraints [('A1', 'A2', '<', '10.0', '1'), ('A2', 'A1', '<=', '10', '1')]

is there any way to test it with pytest?

Edit: for me, this way of documenting my scripts is very convenient. For example, I know exactly what the script does, e.g. rna_filter documentation and I don't want to copy the code to pytest. I would to test them from the docstring.

Marcin Magnus
  • 272
  • 1
  • 9
  • I wrote something like this, for now, [doctest-cmds](https://github.com/mmagnus/doctest-cmds) but this is super basic, I wonder if anyone has done something like this before. – Marcin Magnus Sep 02 '17 at 12:30
  • I found something more, but this does not work with pytest (I think) https://stackoverflow.com/questions/9973895/python-doctest-for-shell-scripts-that-test-argument-parsing-without-polluting-do – Marcin Magnus Sep 04 '17 at 09:57

0 Answers0