summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2016-10-17 15:10:36 -0700
committerDylan Baker <dylan@pnwbakers.com>2016-11-10 10:51:02 -0800
commit0212a1f9d284b547013b955f1f25af994bb5aa70 (patch)
tree42c04570b847fa1ada73c6dbaa9ab0dd9899135e /unittests
parent0d4eb8c6b7bb589bd36b8578979b836155e3bc45 (diff)
framework/profile: replace Testprofile.{dmesg,monitoring} with dict
This allows a significant amount of cleanup to happen. It allows removing attributes from the global OPTIONS, removing tests that no longer apply, and because of the split run method it allows more values to simply be passed. Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Diffstat (limited to 'unittests')
-rw-r--r--unittests/framework/test/test_base.py14
-rw-r--r--unittests/framework/test/test_shader_test.py2
-rw-r--r--unittests/framework/test_profile.py24
3 files changed, 8 insertions, 32 deletions
diff --git a/unittests/framework/test/test_base.py b/unittests/framework/test/test_base.py
index 6b0c299f6..656d839f7 100644
--- a/unittests/framework/test/test_base.py
+++ b/unittests/framework/test/test_base.py
@@ -209,8 +209,8 @@ class TestTest(object):
test.execute(mocker.Mock(spec=six.text_type),
mocker.Mock(spec=log.BaseLog),
- mocker.Mock(spec=dmesg.BaseDmesg),
- mocker.Mock(spec=monitoring.Monitoring))
+ {'dmesg': mocker.Mock(spec=dmesg.BaseDmesg),
+ 'monitor': mocker.Mock(spec=monitoring.Monitoring)})
return test.result
def test_result(self, shared_test):
@@ -321,7 +321,7 @@ class TestValgrindMixin(object):
def test_command(self, mocker):
"""test.base.ValgrindMixin.command: overrides self.command."""
- opts = mocker.patch('framework.test.base.options.OPTIONS',
+ opts = mocker.patch('framework.test.base.OPTIONS',
new_callable=Options)
class Test(base.ValgrindMixin, _Test):
@@ -358,7 +358,7 @@ class TestValgrindMixin(object):
binary itself, so any status other than pass is irrelavent, and
should be marked as skip.
"""
- mock_opts = mocker.patch('framework.test.base.options.OPTIONS',
+ mock_opts = mocker.patch('framework.test.base.OPTIONS',
new_callable=Options)
mock_opts.valgrind = True
@@ -372,7 +372,7 @@ class TestValgrindMixin(object):
def test_problems_with_valgrind_disabled(self, starting, mocker):
"""When valgrind is disabled nothign shoud change
"""
- mock_opts = mocker.patch('framework.test.base.options.OPTIONS',
+ mock_opts = mocker.patch('framework.test.base.OPTIONS',
new_callable=Options)
mock_opts.valgrind = False
@@ -386,7 +386,7 @@ class TestValgrindMixin(object):
"""test.base.ValgrindMixin.run: when test is 'pass' and returncode
is '0' result is pass.
"""
- mock_opts = mocker.patch('framework.test.base.options.OPTIONS',
+ mock_opts = mocker.patch('framework.test.base.OPTIONS',
new_callable=Options)
test = self.test(['foo'])
mock_opts.valgrind = True
@@ -399,7 +399,7 @@ class TestValgrindMixin(object):
"""test.base.ValgrindMixin.run: when a test is 'pass' but
returncode is not 0 it's 'fail'.
"""
- mock_opts = mocker.patch('framework.test.base.options.OPTIONS',
+ mock_opts = mocker.patch('framework.test.base.OPTIONS',
new_callable=Options)
mock_opts.valgrind = True
test = self.test(['foo'])
diff --git a/unittests/framework/test/test_shader_test.py b/unittests/framework/test/test_shader_test.py
index c62aee3f8..5484dca15 100644
--- a/unittests/framework/test/test_shader_test.py
+++ b/unittests/framework/test/test_shader_test.py
@@ -42,7 +42,7 @@ class _Setup(object):
def __init__(self):
self.__patchers = []
self.__patchers.append(mock.patch.dict(
- 'framework.test.base.options.OPTIONS.env',
+ 'framework.test.base.OPTIONS.env',
{'PIGLIT_PLATFORM': 'foo'}))
def setup(self, _):
diff --git a/unittests/framework/test_profile.py b/unittests/framework/test_profile.py
index 9ac0d2176..90673624c 100644
--- a/unittests/framework/test_profile.py
+++ b/unittests/framework/test_profile.py
@@ -27,13 +27,11 @@ from __future__ import (
import pytest
import six
-from framework import dmesg
from framework import exceptions
from framework import grouptools
from framework import profile
from framework.test.gleantest import GleanTest
from . import utils
-from . import skip
# pylint: disable=invalid-name,no-self-use,protected-access
@@ -73,28 +71,6 @@ class TestLoadTestProfile(object):
class TestTestProfile(object):
"""Tests for profile.TestProfile."""
- def test_default_dmesg(self):
- """profile.TestProfile: Dmesg is dummy by default."""
- profile_ = profile.TestProfile()
- assert isinstance(profile_.dmesg, dmesg.DummyDmesg)
-
- @skip.linux
- def test_set_dmesg_true(self):
- """profile.TestProfile: Dmesg returns an appropriate dmesg is set to
- True.
- """
- profile_ = profile.TestProfile()
- profile_.dmesg = True
- assert isinstance(profile_.dmesg, dmesg.LinuxDmesg)
-
- @skip.linux
- def test_set_dmesg_false(self):
- """profile.TestProfile: Dmesg returns a DummyDmesg if set to False."""
- profile_ = profile.TestProfile()
- profile_.dmesg = True
- profile_.dmesg = False
- assert isinstance(profile_.dmesg, dmesg.DummyDmesg)
-
class TestGroupManager(object):
"""Tests for TestProfile.group_manager."""