--- Makefile.am | 3 +++ tests/kickstart_test/commands_test.py | 9 ++++++--- tests/mock/__init__.py | 10 ++++++++++ tests/storage_test/devicelibs_test/crypto_test.py | 2 ++ tests/storage_test/devicelibs_test/lvm_test.py | 2 ++ tests/storage_test/devicelibs_test/mdraid_test.py | 2 ++ tests/storage_test/devicelibs_test/mpath_test.py | 2 ++ tests/storage_test/devicelibs_test/swap_test.py | 2 ++ 8 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index d4f1fd3..374430b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -106,4 +106,7 @@ archive-no-tag: dist # UNIT TESTING TARGETS unittest: + PYTHONPATH=tests/:. nosetests -w tests/ -a \!acceptance,\!slow + +fulltest: PYTHONPATH=tests/:. nosetests -w tests/ diff --git a/tests/kickstart_test/commands_test.py b/tests/kickstart_test/commands_test.py index fcddced..ef33bba 100644 --- a/tests/kickstart_test/commands_test.py +++ b/tests/kickstart_test/commands_test.py @@ -18,7 +18,7 @@ # Author: Chris Lumens <clumens@xxxxxxxxxx> import unittest import sys -from mock import Mock, patch, TestCase +from mock import Mock, patch, TestCase, acceptance class O(object): pass @@ -57,7 +57,8 @@ class CommandVersionTestCase(TestCase): def tearDown(self): self.tearDownModules() - def runTest(self): + @acceptance + def commands_test(self): for (commandName, commandObj) in kickstart.commandMap.iteritems(): baseClass = commandObj().__class__.__bases__[0] pykickstartClass = self.handler.commands[commandName].__class__ @@ -71,7 +72,8 @@ class DataVersionTestCase(unittest.TestCase): self.handler = pykickstart.version.makeVersion(kickstart.ver) - def runTest(self): + @acceptance + def data_test(self): for (dataName, dataObj) in kickstart.dataMap.iteritems(): baseClass = dataObj().__class__.__bases__[0] @@ -80,6 +82,7 @@ class DataVersionTestCase(unittest.TestCase): pykickstartClass = eval("self.handler.%s" % dataName) self.assertEqual(baseClass.__name__, pykickstartClass.__name__) + def suite(): suite = unittest.TestSuite() suite.addTest(CommandVersionTestCase()) diff --git a/tests/mock/__init__.py b/tests/mock/__init__.py index a72d1aa..e62086c 100644 --- a/tests/mock/__init__.py +++ b/tests/mock/__init__.py @@ -24,6 +24,16 @@ from disk import * from mock import * import unittest +def slow(f): + """Decorates a test method as being slow, usefull for python-nose filtering""" + f.slow = True + return f + +def acceptance(f): + """Decorates test as belonging to acceptance testing and not useable in common devellopment unit testing. To be used with python-nose filtering.""" + f.acceptance = True + return f + class TestCase(unittest.TestCase): def __init__(self, *args, **kwargs): unittest.TestCase.__init__(self, *args, **kwargs) diff --git a/tests/storage_test/devicelibs_test/crypto_test.py b/tests/storage_test/devicelibs_test/crypto_test.py index 434fdcb..7837451 100644 --- a/tests/storage_test/devicelibs_test/crypto_test.py +++ b/tests/storage_test/devicelibs_test/crypto_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python import baseclass import unittest +from mock import acceptance import tempfile import os @@ -12,6 +13,7 @@ class CryptoTestCase(baseclass.DevicelibsTestCase): import storage.devicelibs.crypto as crypto + @acceptance def testCrypto(self): ## ## is_luks diff --git a/tests/storage_test/devicelibs_test/lvm_test.py b/tests/storage_test/devicelibs_test/lvm_test.py index 734644d..1e07345 100644 --- a/tests/storage_test/devicelibs_test/lvm_test.py +++ b/tests/storage_test/devicelibs_test/lvm_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python import baseclass import unittest +from mock import acceptance class LVMTestCase(baseclass.DevicelibsTestCase): @@ -8,6 +9,7 @@ class LVMTestCase(baseclass.DevicelibsTestCase): baseclass.DevicelibsTestCase.setUp(self) import storage.devicelibs.lvm as lvm + @acceptance def testLVM(self): ## ## pvcreate diff --git a/tests/storage_test/devicelibs_test/mdraid_test.py b/tests/storage_test/devicelibs_test/mdraid_test.py index 9dde22d..4a1c836 100644 --- a/tests/storage_test/devicelibs_test/mdraid_test.py +++ b/tests/storage_test/devicelibs_test/mdraid_test.py @@ -2,6 +2,7 @@ import baseclass import unittest import time +from mock import acceptance class MDRaidTestCase(baseclass.DevicelibsTestCase): @@ -9,6 +10,7 @@ class MDRaidTestCase(baseclass.DevicelibsTestCase): baseclass.DevicelibsTestCase.setUp(self) import storage.devicelibs.mdraid as mdraid + @acceptance def testMDRaid(self): ## ## getRaidLevels diff --git a/tests/storage_test/devicelibs_test/mpath_test.py b/tests/storage_test/devicelibs_test/mpath_test.py index 813a516..7b7f9fa 100644 --- a/tests/storage_test/devicelibs_test/mpath_test.py +++ b/tests/storage_test/devicelibs_test/mpath_test.py @@ -1,12 +1,14 @@ #!/usr/bin/python import baseclass import unittest +from mock import acceptance class MPathTestCase(baseclass.DevicelibsTestCase): def setUp(self): baseclass.DevicelibsTestCase.setUp(self) import storage.devicelibs.mpath as mpath + @acceptance def testMPath(self): ## ## parseMultipathOutput diff --git a/tests/storage_test/devicelibs_test/swap_test.py b/tests/storage_test/devicelibs_test/swap_test.py index ddf8d21..e399e61 100644 --- a/tests/storage_test/devicelibs_test/swap_test.py +++ b/tests/storage_test/devicelibs_test/swap_test.py @@ -1,6 +1,7 @@ #!/usr/bin/python import baseclass import unittest +from mock import acceptance class SwapTestCase(baseclass.DevicelibsTestCase): @@ -8,6 +9,7 @@ class SwapTestCase(baseclass.DevicelibsTestCase): baseclass.DevicelibsTestCase.setUp(self) import storage.devicelibs.swap as swap + @acceptance def testSwap(self): ## ## mkswap -- 1.6.6.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list