Open svanoort opened 9 years ago
If we want to keep the class elements... each class can define its own parse table? Something like SYNTAX_ELEMENTS. Then we can use this to do parsing?
Addendum: let's add the ability to add documentation strings to these! Then we can use a generator & template for syntax documentation. One less place to make changes when extending the framework.
Proposal:
For autodocumented code, use Sphinx, helpful links:
https://codeandchaos.wordpress.com/2012/07/30/sphinx-autodoc-tutorial-for-dummies/ http://thomas-cokelaer.info/tutorials/sphinx/docstring_python.html https://pythonhosted.org/an_example_pypi_project/sphinx.html
Kicking back to 1.8 milestone: collision with the Unicode/Python 3 compatibility/test coverage for that means this is just too much to take on at the moment.
The way parsing is handled for the core tests is a nightmare and seriously impedes the ability to extend pyresttest. We have a special case for each parse option, and the handling of command-line, test-level, and testset options is completely bonkers, since has separate parsing code.
Let's apply lessons learnt to fix this. Instead of the long, brutish mess of parsing (and test of the parsing), let's apply the lessons learned in the validator classes, and apply a registry + dynamic parse function method. But, let's do it better since type coercion is required.
Use registries:
Need to think about options, but items will be iteratively run through each dictionary looking for matches and then handed to parse functions. For options, if duplicates are added, they'll be combined together.
For the command-line ("global") arguments, they need to get mapped to an option too, but it'll be more flexible.
This also acts as a useful and compatibility-maintaining precursor to the nested context structure from https://github.com/svanoort/pyresttest/issues/45.
Work Items