.
http://docs.python.org/library/unittest.html#unittest.TestLoader.loadTestsFromName
, , , .
A, AIX, Linux () 32- Windows, B, Windows 64, Linux 64 Solaris, C, , HPUX D, ... ?
class TestA_AIX_Linux2_Win32( unittest.TestCase ):
class TestB_Win64_Linux64_Solaris( unittest.TestCase ):
class TestC_AIX_Linux2_Win32_Win64_Linux64_Solaris( unittest.TestCase ):
class TestD_All( unittest.TestCase ):
- " HP/UX". . , HP/UX. .
"" - , .
-
class TextC_XHPUX( unittest.TestCase ):
"_someOSName"; , "_X".
"We cannot have a positive OS list. What if we add a new OS? Do we need to rename each test to explicitly enable it?" Yes. The market for new operating systems is slowly developing, it is not so painful to manage.
An alternative is to include information in each class (for example, a class level function) or a decorator and use a specialized class loader that evaluates the class level function.
source
share