add a few tips on adding tests, and kinks in the current system, I hope to fix the...
[portage.git] / TEST-NOTES
1 UnitTests
2 ---------
3
4 Portage has some tests that use the unittest framework that ships with python (2.3-2.4ish)
5 Tests have a specific naming convention.
6
7 in tests/ there is a runTest script that invokes tests/__init__.py
8
9 This init looks at a hardcoded list of test dirs to search for tests.
10 If you add a new dir and don't see your new tests, make sure that the dir is in this list.
11
12 On the subject of adding more directories; the layout is basically 1 directory per portage
13 file at this point (we have few files, and even fewer large files).  Inside of the dir
14 you should have files of the form test_${function}.py.
15
16 So if I was to write a vercmp test, and vercmp is in portage_versions.
17
18 tests/portage_versions/test_vercmp.py
19
20 would be the filename.
21
22 The __init__.py file in tests only goes 1 deep (it's non-recursive, in other words).  If
23 you end up with more directories it will probably break at present.  Need to replace the
24 '/' in the directory path with a '.' (for proper importing).  This should be trivial to fix.