The signature of the stub version was not updated when the real version was, which means setting the environment variable will raise an exception.
Also adds some tests for this problem. Signed-off-by: Dylan Baker <[email protected]> --- framework/test/opengl.py | 6 +++-- unittests/framework/test/test_opengl.py | 41 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/framework/test/opengl.py b/framework/test/opengl.py index 51c8f19..6fe8670 100644 --- a/framework/test/opengl.py +++ b/framework/test/opengl.py @@ -382,7 +382,9 @@ class FastSkipMixin(object): class FastSkipMixinDisabled(object): - def __init__(self, *args, **kwargs): + def __init__(self, command, gl_required=None, gl_version=None, + gles_version=None, glsl_version=None, glsl_es_version=None, + **kwargs): # pylint: disable=too-many-arguments # Tests that implement the FastSkipMixin expect to have these values # set, so just fill them in with the default values. self.gl_required = set() @@ -391,7 +393,7 @@ class FastSkipMixinDisabled(object): self.glsl_version = None self.glsl_es_version = None - super(FastSkipMixinDisabled, self).__init__(*args, **kwargs) + super(FastSkipMixinDisabled, self).__init__(command, **kwargs) # Shadow the real FastSkipMixin with the Disabled version if diff --git a/unittests/framework/test/test_opengl.py b/unittests/framework/test/test_opengl.py index e782d33..6381373 100644 --- a/unittests/framework/test/test_opengl.py +++ b/unittests/framework/test/test_opengl.py @@ -417,6 +417,16 @@ class TestFastSkipMixin(object): # pylint: disable=too-many-public-methods def inst(self): return self._Test(['foo']) + def test_api(self): + """Tests that the api works. + + Since you're not suppoed to be able to pass gl and gles version, this + uses two seperate constructor calls. + """ + self._Test(['foo'], gl_required={'foo'}, gl_version=3, glsl_version=2) + self._Test(['foo'], gl_required={'foo'}, gles_version=3, + glsl_es_version=2) + def test_should_skip(self, inst): """test.opengl.FastSkipMixin.is_skip: Skips when requires is missing from extensions. @@ -554,3 +564,34 @@ class TestFastSkipMixin(object): # pylint: disable=too-many-public-methods def test_max_glsl_es_version_set(self, inst): """test.opengl.FastSkipMixin.is_skip: runs if glsl_es_version is None""" inst.is_skip() + + +class TestFastSkipMixinDisabled(object): + """Tests for the sub version.""" + + @pytest.yield_fixture(autouse=True, scope='class') + def patch(self): + """Create a Class with FastSkipMixin, but patch various bits.""" + _mock_wflinfo = mock.Mock(spec=opengl.WflInfo) + _mock_wflinfo.gl_version = 3.3 + _mock_wflinfo.gles_version = 3.0 + _mock_wflinfo.glsl_version = 3.3 + _mock_wflinfo.glsl_es_version = 2.0 + _mock_wflinfo.gl_extensions = set(['bar']) + + with mock.patch.object(self._Test, '_FastSkipMixin__info', + _mock_wflinfo): + yield + + class _Test(opengl.FastSkipMixin, utils.Test): + pass + + def test_api(self): + """Tests that the api works. + + Since you're not suppoed to be able to pass gl and gles version, this + uses two seperate constructor calls. + """ + self._Test(['foo'], gl_required={'foo'}, gl_version=3, glsl_version=2) + self._Test(['foo'], gl_required={'foo'}, gles_version=3, + glsl_es_version=2) -- 2.9.3 _______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
