|
|
e2df08 |
From 5cc0b67726652b56815cf3459737260e3e3479ba Mon Sep 17 00:00:00 2001
|
|
|
e2df08 |
From: Cole Robinson <crobinso@redhat.com>
|
|
|
e2df08 |
Date: Sun, 21 Sep 2014 15:26:03 -0400
|
|
|
e2df08 |
Subject: [PATCH 1/2] tests: Ensure osdict.py aliases is never extended
|
|
|
e2df08 |
|
|
|
e2df08 |
(cherry picked from commit b3fa8bb650c1ecfbb13ee6235fc7a306a0f0b318)
|
|
|
e2df08 |
---
|
|
|
e2df08 |
tests/misc.py | 9 +++++++++
|
|
|
e2df08 |
virtinst/osdict.py | 2 ++
|
|
|
e2df08 |
2 files changed, 11 insertions(+)
|
|
|
e2df08 |
|
|
|
e2df08 |
diff --git a/tests/misc.py b/tests/misc.py
|
|
|
e2df08 |
index ca91595..b532cdf 100644
|
|
|
e2df08 |
--- a/tests/misc.py
|
|
|
e2df08 |
+++ b/tests/misc.py
|
|
|
e2df08 |
@@ -112,3 +112,12 @@ class TestMisc(unittest.TestCase):
|
|
|
e2df08 |
raise AssertionError("The following files require a gtk version "
|
|
|
e2df08 |
"higher than our target of gtk-3.8:\n" +
|
|
|
e2df08 |
"\n".join([("%s version=%s" % tup) for tup in failures]))
|
|
|
e2df08 |
+
|
|
|
e2df08 |
+ def test_libosinfo_aliases_ro(self):
|
|
|
e2df08 |
+ from virtinst import osdict
|
|
|
e2df08 |
+ aliases = getattr(osdict, "_aliases")
|
|
|
e2df08 |
+
|
|
|
e2df08 |
+ if len(aliases) != 36:
|
|
|
e2df08 |
+ raise AssertionError(_("osdict._aliases changed size. It "
|
|
|
e2df08 |
+ "should never be extended, since it is only for back "
|
|
|
e2df08 |
+ "compat with pre-libosinfo osdict."))
|
|
|
e2df08 |
diff --git a/virtinst/osdict.py b/virtinst/osdict.py
|
|
|
e2df08 |
index f792012..4659019 100644
|
|
|
e2df08 |
--- a/virtinst/osdict.py
|
|
|
e2df08 |
+++ b/virtinst/osdict.py
|
|
|
e2df08 |
@@ -25,6 +25,8 @@ from datetime import datetime
|
|
|
e2df08 |
from gi.repository import Libosinfo as libosinfo
|
|
|
e2df08 |
from inspect import isfunction
|
|
|
e2df08 |
|
|
|
e2df08 |
+# This is only for back compatibility with pre-libosinfo support.
|
|
|
e2df08 |
+# This should never change.
|
|
|
e2df08 |
_aliases = {
|
|
|
e2df08 |
"altlinux" : "altlinux1.0",
|
|
|
e2df08 |
"debianetch" : "debian4",
|
|
|
e2df08 |
--
|
|
|
e2df08 |
1.9.3
|
|
|
e2df08 |
|