[Piglit] [PATCH] framework: deepcopy TestProfile's filters when copying it

Dylan Baker dylan at pnwbakers.com
Thu Jul 19 23:46:59 UTC 2018


Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

Quoting Andres Gomez (2018-07-19 15:39:05)
> This avoids modifications in the original filters object.
> 
> Detected through Travis CI.
> 
> Fixed also a couple of typos.
> 
> Fixes: 1f0f2ad25 ("framework: Add filters class")
> Cc: Dylan Baker <dylanx.c.baker at intel.com>
> Cc: Michel Dänzer <michel.daenzer at amd.com>
> Signed-off-by: Andres Gomez <agomez at igalia.com>
> ---
>  framework/profile.py                        | 5 ++++-
>  unittests/framework/summary/test_feature.py | 2 +-
>  unittests/framework/utils.py                | 2 +-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/framework/profile.py b/framework/profile.py
> index a6cac2cf0..8d6fd0706 100644
> --- a/framework/profile.py
> +++ b/framework/profile.py
> @@ -501,11 +501,14 @@ class TestProfile(object):
>          This method creates a copy with references to the original instance
>          using copy.copy. This allows profiles to be "subclassed" by other
>          profiles, without modifying the original.
> +
> +        copy.deepcopy is used for the filters so the original is
> +        actually not modified in this case.
>          """
>          new = copy.copy(self)
>          new.test_list = copy.copy(self.test_list)
>          new.forced_test_list = copy.copy(self.forced_test_list)
> -        new.filters = copy.copy(self.filters)
> +        new.filters = copy.deepcopy(self.filters)
>          return new
>  
>      def itertests(self):
> diff --git a/unittests/framework/summary/test_feature.py b/unittests/framework/summary/test_feature.py
> index fc05941b6..905484991 100644
> --- a/unittests/framework/summary/test_feature.py
> +++ b/unittests/framework/summary/test_feature.py
> @@ -77,7 +77,7 @@ PROFILE.test_list['spec at gl-2.0@d'] = _maketest('fail')
>  
>  
>  class TestFeatResult(object):
> -    """Tests fro the FeatResult class."""
> +    """Tests for the FeatResult class."""
>  
>      @pytest.fixture(scope='session')
>      def feature(self, tmpdir_factory):
> diff --git a/unittests/framework/utils.py b/unittests/framework/utils.py
> index bb3a19146..15117f97d 100644
> --- a/unittests/framework/utils.py
> +++ b/unittests/framework/utils.py
> @@ -32,7 +32,7 @@ from framework.test.base import Test as _Test
>  
>  
>  class Test(_Test):
> -    """A Test dericed class with a stub interpret_result.
> +    """A Test derived class with a stub interpret_result.
>  
>      This class provides a way to test the Test class.
>      """
> -- 
> 2.18.0
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20180719/5d771bdb/attachment.sig>


More information about the Piglit mailing list