Menu

#2 Patch for testcase class/name

open
None
5
2009-05-02
2009-02-16
Sok Ann Yap
No

I have been using nosexunit with hudson and it works great. Recently, I added some testcases using the generator feature of nosetests (yield), which caused a bit of problem for nosexunit to get their class/name, as the name of a testcase may now contain:
- characters such as &, <, >, " that have to escaped in xml, e.g. package.module.Class.method[<Test 123>, "abc"]
- dots that can mess up the logic of splitting the string into package name, class name, and test name, e.g. module.method[1.2, 3.4]

Thus, I have come up with the attached patch (against 0.3.2) that does the following:
- escape the class name and test name attributes within <testcase>
- improve logic in dots splitting by detecting splitted part that is not a valid python identifier
- retrieve the class and name earlier during addTest(), to prevent getting them later in the form of nose.nose.uuid (e.g. without the patch, I always got nose.nose.uuid for tests that make use of fixture's SQLAlchemyLoadable, since the fixture would have long been unloaded when it get to writeXmlOnStream())

I will attach a tarball later that will contain some sample tests. That should make it easier to compare the output from nosexunit with or without the patch :)

Discussion

  • Sok Ann Yap

    Sok Ann Yap - 2009-02-16

    patch

     
  • Sok Ann Yap

    Sok Ann Yap - 2009-02-16

    sample tests (requires SQLAlchemy>=0.5.0, fixture>=1.1.2)

     
  • Olivier Mansion

    Olivier Mansion - 2009-05-02
    • assigned_to: nobody --> omansion
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.