clalancette/oz — pull request #128 by helgi (2013-10-28 16:11:49+00:00)
Title: Increase test coverage

Increases the test coverage on many of the XML handling functions and code around them. Had to do a few fixes in Guest.py and TDL.py to make it easier to test and more consistent with other XML passing around.

Also tested `distrolist()` in GuestFactory. It does mean when any new versions of a distro comes out that tests has to be updated but that can also help us.

I wasn't too sure if the additional should live in the TDL test file given how most things are being tested in there but I ended up doing what test_peristant was done like.

Coverage before:
```
Name Stmts Miss Cover
-------------------------------------
oz/Debian 54 34 37%
oz/Fedora 43 18 58%
oz/FedoraCore 25 7 72%
oz/Guest 1071 820 23%
oz/GuestFactory 23 9 61%
oz/Mageia 50 50 0%
oz/Mandrake 77 50 35%
oz/Mandriva 50 31 38%
oz/OpenSUSE 282 232 18%
oz/OzException 4 0 100%
oz/RHEL_2_1 15 1 93%
oz/RHEL_3 39 18 54%
oz/RHEL_4 47 24 49%
oz/RHEL_5 53 30 43%
oz/RHEL_6 26 7 73%
oz/RHL 44 14 68%
oz/RedHat 659 569 14%
oz/TDL 239 41 83%
oz/Ubuntu 440 353 20%
oz/Windows 94 54 43%
oz/__init__ 0 0 100%
oz/linuxutil 11 8 27%
oz/ozutil 468 144 69%
-------------------------------------
TOTAL 3814 2514 34%
```

After:
```
Name Stmts Miss Cover
-------------------------------------
oz/Debian 54 33 39%
oz/Fedora 43 17 60%
oz/FedoraCore 25 6 76%
oz/Guest 1075 669 38%
oz/GuestFactory 23 0 100%
oz/Mageia 50 36 28%
oz/Mandrake 77 49 36%
oz/Mandriva 50 30 40%
oz/OpenSUSE 282 231 18%
oz/OzException 4 0 100%
oz/RHEL_2_1 15 0 100%
oz/RHEL_3 39 17 56%
oz/RHEL_4 47 23 51%
oz/RHEL_5 53 29 45%
oz/RHEL_6 26 6 77%
oz/RHL 44 13 70%
oz/RedHat 659 569 14%
oz/TDL 236 16 93%
oz/Ubuntu 440 352 20%
oz/Windows 94 53 44%
oz/__init__ 0 0 100%
oz/linuxutil 11 8 27%
oz/ozutil 468 144 69%
-------------------------------------
TOTAL 3815 2301 40%
```

May not seem like a lot but `Guest` and `TDL` both got a good hike

Here's how to generate the coverage reports without using junit

```
pip install coverage
py.test --genscript=runtests.py
coverage run --source oz runtests.py -vv tests
```

I had to use runtests.py to get any real coverage. It seems the way the test functionality is setup in setup.py wasn't aggreeing with coverage.py. http://pytest.org/latest/goodpractises.html uses runtests.py as well for distutils