[PATCH] Run the pykickstart version test on the commands in parse-dracut

Vratislav Podzimek vpodzime at redhat.com
Tue Mar 25 11:03:17 UTC 2014


On Mon, 2014-03-24 at 16:33 -0400, David Shea wrote:
> ---
>  tests/kickstart_tests/version_test.py | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/tests/kickstart_tests/version_test.py b/tests/kickstart_tests/version_test.py
> index c3650f8..4816547 100644
> --- a/tests/kickstart_tests/version_test.py
> +++ b/tests/kickstart_tests/version_test.py
> @@ -18,6 +18,7 @@
>  # Author: Chris Lumens <clumens at redhat.com>
>  from mock import Mock
>  import unittest
> +import os
>  
>  class BaseTestCase(unittest.TestCase):
>      def setUp(self):
> @@ -50,3 +51,21 @@ class DataVersionTestCase(BaseTestCase):
>              # it does command objects.
>              pykickstartClass = eval("self.handler.%s" % dataName)
>              self.assertIsInstance(dataObj(), pykickstartClass)
> +
> +# Copy the commands tests but with the command map from dracut/parse-kickstart
> +class DracutCommandVersionTestCase(CommandVersionTestCase):
> +    def setUp(self):
> +        CommandVersionTestCase.setUp(self)
> +
> +        # top_srcdir should have been set by nosetests.sh. If it wasn't, the KeyError
> +        # will fail the test.
> +        parse_kickstart_path = os.path.join(os.environ['top_srcdir'], 'dracut', 'parse-kickstart')
> +
> +        # Use imp to pretend that hyphens are ok for module names
> +        import imp
> +
> +        with open(parse_kickstart_path) as parse_kickstart_file:
> +            parse_module = imp.load_module('parse_kickstart', parse_kickstart_file,
> +                    parse_kickstart_path, ('', 'r', imp.PY_SOURCE))
> +
> +        self._commandMap = parse_module.dracutCmds
ACK.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list