From: Waylan L. <wa...@gm...> - 2007-11-06 01:30:58
|
After working on safe_mode to add escaping, I realized that there's no way to test safe_mode in the testing framework. A few possibilities occurred to me. We could use the same approach as extensions (well the way they're supposed to work - currently they're ignored afaict) and have a separate directory for each state. Thing is, the same text files could easily work with each of the possible modes. So another option would be to include additional html files in the existing directories with a special name (ie, "escaped-somefile.html). If those files exist, then additional tests would be run in the appropriate mode. It also occurs to me that some unit tests may be helpful for testing the api. Maybe some simple tests of safe_mode there would be sufficient. The question is, should any unit tests be part of test-markdown.py or separate? Anyone have any thoughts? I'm thinking this is what I'm tackling after 1.7 is released. -- ---- Waylan Limberg wa...@gm... |
From: Trent M. <tr...@gm...> - 2007-11-06 05:32:48
|
On 11/5/07, Waylan Limberg <wa...@gm...> wrote: > After working on safe_mode to add escaping, I realized that there's no > way to test safe_mode in the testing framework. A few possibilities > occurred to me. The way I do it in markdown2.py's test suite is to have a "foo.opts" file beside the "foo.txt" and "foo.html". The test harness looks for a corresponding ".opts" file, reads it, evals it as Python (it must be a Python dict) and passes it to the convert function via kwargs. For example: http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/safe_mode.text http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/safe_mode.html http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/safe_mode.opts > Thing is, the same text files could easily work with each of the > possible modes. So another option would be to include additional html > files in the existing directories with a special name (ie, > "escaped-somefile.html). If those files exist, then additional tests > would be run in the appropriate mode. I've tried that before -- in another project -- and found it too limiting. For example, this kind of this couldn't be done: http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/link_patterns.opts Cheers, Trent -- Trent Mick tr...@gm... |
From: Yuri T. <qar...@gm...> - 2007-11-06 05:51:56
|
Yes, I think you are right. I used "ext-x-tables" approach in my test script because I was looking for a simple solution. I only wanted to test one extension at a time, and for that simple case this worked well, since you could see from the directory name what is being test. If we want to preserve this feature, perhaps the thing to do would be to check for some patter in the directory name, and look for a .opts file in that case. I.e.: all tests in "basic" would be run with default options, all tests in "ext-x-tables" would be run with the tables extension, and all tests in "basic-with-options" would look for .opts file for each test. Or we could just always look for .opts. In either case, have anyone looked at both test scripts enough to report on what the pros and cons of each are? If Trent's test script does all that ours does and more, we could just use it instead. - yuri On Nov 5, 2007 11:32 PM, Trent Mick <tr...@gm...> wrote: > On 11/5/07, Waylan Limberg <wa...@gm...> wrote: > > After working on safe_mode to add escaping, I realized that there's no > > way to test safe_mode in the testing framework. A few possibilities > > occurred to me. > > The way I do it in markdown2.py's test suite is to have a "foo.opts" > file beside the "foo.txt" and "foo.html". The test harness looks for a > corresponding ".opts" file, reads it, evals it as Python (it must be a > Python dict) and passes it to the convert function via kwargs. > > For example: > > http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/safe_mode.text > http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/safe_mode.html > http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/safe_mode.opts > > > Thing is, the same text files could easily work with each of the > > possible modes. So another option would be to include additional html > > files in the existing directories with a special name (ie, > > "escaped-somefile.html). If those files exist, then additional tests > > would be run in the appropriate mode. > > I've tried that before -- in another project -- and found it too > limiting. For example, this kind of this couldn't be done: > > http://python-markdown2.googlecode.com/svn/trunk/test/tm-cases/link_patterns.opts > > Cheers, > Trent > > -- > Trent Mick > tr...@gm... > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > -- Yuri Takhteyev Ph.D. Candidate, UC Berkeley School of Information http://takhteyev.org/, http://www.freewisdom.org/ |
From: Trent M. <tr...@gm...> - 2007-11-06 05:57:46
|
> If Trent's test script does > all that ours does and more, we could just use it instead. Please feel free. The main generic harness support is test/testlib.py (provided for TestSkipped -- sometimes useful, listing available test cases, and tagging and command-line filtering to run specific tests). The markdown2-specific harness (test_markdown2.py) generates individual unittest.TestCase methods for each text file in given test case dirs. It should be very straighforward for you to re-use it. Trent -- Trent Mick tr...@gm... |