[Piglit] [PATCH 01/11] profile_tests.py: Add tests for loadTestProfile

Dylan Baker baker.dylan.c at gmail.com
Fri Apr 25 13:27:33 PDT 2014


---
 framework/profile.py             |  2 +-
 framework/tests/profile_tests.py | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/framework/profile.py b/framework/profile.py
index 9f0bf48..21c2747 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -239,5 +239,5 @@ def merge_test_profiles(profiles):
     """
     profile = loadTestProfile(profiles.pop())
     for p in profiles:
-        profile.update(loadTestProfile(p))
+        profile.update(TestProfile(p))
     return profile
diff --git a/framework/tests/profile_tests.py b/framework/tests/profile_tests.py
index c5bdf34..7881b24 100644
--- a/framework/tests/profile_tests.py
+++ b/framework/tests/profile_tests.py
@@ -20,9 +20,28 @@
 
 """ Provides test for the framework.profile modules """
 
+import nose.tools as nt
 import framework.profile as profile
 
 
 def test_initialize_testprofile():
     """ TestProfile initializes """
     profile.TestProfile()
+
+
+ at nt.raises(SystemExit)
+def test_load_test_profile_no_profile():
+    """ Loading a module with no profile name exits
+
+    Beacuse loadTestProfile uses test.{} to load a module we need a module in
+    tests that doesn't have a profile attribute. The only module that currently
+    meets that requirement is __init__.py
+
+    """
+    profile.loadTestProfile('__init__')
+
+
+def test_load_test_profile_returns():
+    """ loadTestProfile returns a TestProfile instance """
+    profile_ = profile.loadTestProfile('sanity')
+    assert isinstance(profile_, profile.TestProfile)
-- 
2.0.0.rc0



More information about the Piglit mailing list