Summary of flapping tests on sn-devel

Douglas Bagnall douglas.bagnall at catalyst.net.nz
Sat Mar 12 09:08:40 UTC 2016


hi Metze,

On 12/03/16 01:03, Stefan Metzmacher wrote:

> I've also (hopefully) fixed the new problem with python 2.6:
> [1804(11085)/1902 at 1h57m2s]
> samba4.ldap.sort.python(ad_dc_ntvfs)(ad_dc_ntvfs)
> Traceback (most recent call last):
>   File
> "/memdisk/autobuild/fl/b3372584/samba/source4/dsdb/tests/python/sort.py", line
> 8, in <module>
>     from collections import Counter
> ImportError: cannot import name Counter

Thanks and sorry about that. Garming warned me of the same, but I
wasn't organised enough to get my patch out.

> From 1741aac7f4b426dadc99bc307825f03abb092904 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Fri, 11 Mar 2016 10:39:13 +0100
> Subject: [PATCH 2/3] s4:dsdb/test/sort: avoid 'from collections import
>  Counter'
> 
> This is only available in python 2.7 and >= 3.1
> 
> This should fix make test with python 2.6.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  source4/dsdb/tests/python/sort.py | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/source4/dsdb/tests/python/sort.py b/source4/dsdb/tests/python/sort.py
> index c4d2c44..b7b9d83 100644
> --- a/source4/dsdb/tests/python/sort.py
> +++ b/source4/dsdb/tests/python/sort.py
> @@ -5,7 +5,6 @@ from unicodedata import normalize
>  import locale
>  locale.setlocale(locale.LC_ALL, ('en_US', 'UTF-8'))
>  
> -from collections import Counter
>  import optparse
>  import sys
>  import os
> @@ -191,7 +190,13 @@ class BaseSortTests(samba.tests.TestCase):
>                  self.expected_results[k] = (fixed, list(reversed(fixed)))
>          for k in ('streetAddress', 'postalAddress'):
>              if k in self.expected_results:
> -                c = Counter([u[k] for u in self.users])
> +                c = {}
> +                for u in self.users:
> +                    x = u[k]
> +                    if x in c:
> +                        c[x] += 1
> +                        continue
> +                    c[x] = 1
>                  fixed = []
>                  for x in FIENDISH_TESTS:
>                      fixed += [norm(x)] * c[x]
> -- 
> 1.9.1

This looks correct.

thanks
Douglas



More information about the samba-technical mailing list