ebuild: fetch: Flatten conditionals in _get_fetch_resume_size
[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 pym/portage/tests/ there is a runTest script that invokes pym/portage/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 pym/portage/tests/portage_versions/test_vercmp.py
19
20 would be the filename.
21
22 The __init__.py file now does recursive tests, but you need to tell it so.  For example, if
23 you had cache tests the dir format would be something like...
24
25 pym/portage/tests/cache/flat_hash/test_foo.py
26
27 and you would put "cache/flat_hash" into the testDirs variable in __init__.py.
28
29
30 Skipping
31 --------
32
33 Please use the portage.tests.* classes as they support throwing a SkipException for
34 tests that are known to fail.  Normally one uses testing to do Test Driven Development
35 (TDD); however we do not do that here.  Therefore there are times when legitimate tests
36 exist but fail due to code in trunk.  We would still like the suite to pass in some instances
37 because the suite is built around two things, testing functionality in the current code as
38 well as poking holes in the current code (isvalidatom is an example).  So sometimes we desire
39 a test to point out that "this needs fixing" but it doesn't affect portage's overall
40 functionality.  You should raise portage.tests.SkipException in that case.
41
42 emerge
43 ------
44
45 The emerge namespace currently has 0 tests (and no runner)