piglit is broken on python3 without these, I'm planning to push soon.

Quoting Dylan Baker (2016-09-16 13:46:04)
> Ensure that it converts bytes to str and also collects correctly.
> 
> Signed-off-by: Dylan Baker <dylanx.c.ba...@intel.com>
> ---
>  unittests/framework/test_driver_classifier.py | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/unittests/framework/test_driver_classifier.py 
> b/unittests/framework/test_driver_classifier.py
> index a4b043a..4c20842 100644
> --- a/unittests/framework/test_driver_classifier.py
> +++ b/unittests/framework/test_driver_classifier.py
> @@ -19,10 +19,23 @@
>  # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
> DEALINGS
>  # IN THE SOFTWARE.
>  
> +"""Tests for the driver_classifier module."""
> +
> +from __future__ import (
> +    absolute_import, division, print_function, unicode_literals
> +)
> +
> +try:
> +    import mock
> +except ImportError:
> +    from unittest import mock
> +
>  import pytest
>  import six
> +
>  from framework import driver_classifier
>  
> +
>  class DriverClassifierTester(driver_classifier.DriverClassifier):
>      """Test class for the driver classifier, taking in a fixed
>  
> @@ -58,3 +71,15 @@ class TestDriverClassifier(object):
>          categories list comes back.
>          """
>          assert DriverClassifierTester(renderer).categories == categories
> +
> +    def test_collect_glxinfo(self):
> +        """Should set self.renderer."""
> +        test = driver_classifier.DriverClassifier()
> +        with 
> mock.patch('framework.driver_classifier.subprocess.check_output',
> +                        mock.Mock(return_value=b'some data\nand some more\n'
> +                                               b'OpenGL renderer string: '
> +                                               b'sentinal\nand some other '
> +                                               b'stuff')):
> +            test.collect_glxinfo()
> +        assert isinstance(test.renderer, six.text_type)
> +        assert test.renderer == 'sentinal'
> -- 
> 2.9.3
> 

Attachment: signature.asc
Description: signature

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to