[Kimchi-devel] [PATCH 2/2] Fix test_osinfo.py to use new modern distro version dict.

Sheldon shaohef at linux.vnet.ibm.com
Mon Mar 3 12:06:28 UTC 2014


Reviewed-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

On 03/01/2014 03:52 AM, Paulo Vital wrote:
> Fix the testcase to use the new format of the modern distro version
> dictionary.
>
> In addition, fixed PEP8 issues and added this file to Makefile.am
>
> Signed-off-by: Paulo Vital <pvital at linux.vnet.ibm.com>
> ---
>   Makefile.am          | 1 +
>   tests/test_osinfo.py | 9 +++++----
>   2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/Makefile.am b/Makefile.am
> index 22944d5..0fd019e 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -61,6 +61,7 @@ PEP8_WHITELIST = \
>   	tests/test_config.py.in \
>   	tests/test_mockmodel.py \
>   	tests/test_model.py \
> +	tests/test_osinfo.py \
>   	tests/test_plugin.py \
>   	tests/test_rest.py \
>   	tests/test_rollbackcontext.py \
> diff --git a/tests/test_osinfo.py b/tests/test_osinfo.py
> index 8020895..104e7b8 100644
> --- a/tests/test_osinfo.py
> +++ b/tests/test_osinfo.py
> @@ -15,12 +15,12 @@
>   #
>   # You should have received a copy of the GNU Lesser General Public
>   # License along with this library; if not, write to the Free Software
> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
>
>   import unittest
>
>
> -from kimchi.osinfo import lookup, modern_version_bases
> +from kimchi.osinfo import lookup, modern_version_bases, _get_arch
>
>
>   class OSInfoTests(unittest.TestCase):
> @@ -31,7 +31,8 @@ class OSInfoTests(unittest.TestCase):
>           self.assertEquals(['default'], entry['networks'])
>
>       def test_fedora_lookup(self):
> -        cd = 'http://fedora.mirrors.tds.net/pub/fedora/releases/17/Live/x86_64/Fedora-17-x86_64-Live-Desktop.iso'
> +        cd = ('http://fedora.mirrors.tds.net/pub/fedora/releases/17/Live/'
> +              'x86_64/Fedora-17-x86_64-Live-Desktop.iso')
>           entry = lookup('fedora', '17')
>           self.assertEquals(10, entry['disks'][0]['size'])
>           self.assertEquals(cd, entry['cdrom'])
> @@ -46,7 +47,7 @@ class OSInfoTests(unittest.TestCase):
>               self.assertEquals(entry['nic_model'], 'e1000')
>
>       def test_modern_bases(self):
> -        for distro, version in modern_version_bases.iteritems():
> +        for distro, version in modern_version_bases[_get_arch()].iteritems():
>               entry = lookup(distro, version)
>               self.assertEquals(entry['disk_bus'], 'virtio')
>               self.assertEquals(entry['nic_model'], 'virtio')


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list