merge default heads

authorJulien Cristau <julien.cristau@logilab.fr>
changesete9fc9f452231
branchdefault
phasepublic
hiddenno
parent revision#62e511de388f [deprecation] stacklevel tweaks, #34363df41323 fix assertIsNotNone py< 2.7 implementation
child revision#48b033f2b81e Backport fix done by Benedikt Morbach on pylint for python3 install on win32 platforms / cross compilation. Closes #180836, #b42796404f1b [date] Fixed: wrong incrementation of month in date_range function (closes #186698)., #0b5866b2bd8e [test] Fix broken unittest_configuration.py:ConfigurationTC.test_round_trip, #245abb4e495d Use 'env' to run the interpreter.
files modified by this revision
ChangeLog
modutils.py
testlib.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1382704887 -7200
# Fri Oct 25 14:41:27 2013 +0200
# Node ID e9fc9f4522317c21d543a41a4f630d5fb3142e8f
# Parent 62e511de388fc18f663f4b25e0bcdbab009cb4b2
# Parent 34363df4132345f7bcc41526a2956f9a6487a909
merge default heads

diff --git a/ChangeLog b/ChangeLog
@@ -1,8 +1,12 @@
1  ChangeLog for logilab.common
2  ============================
3 
4 +--
5 +   * modutils: don't propagate IOError when package's __init__.py file doesn't
6 +     exist (#174606)
7 +
8  2013-07-26  --  0.60.0
9      * configuration: rename option_name method into option_attrname (#140667)
10 
11      * deprecation: new DeprecationManager class (closes #108205)
12 
diff --git a/modutils.py b/modutils.py
@@ -654,18 +654,22 @@
13              if mtype != PKG_DIRECTORY:
14                  raise ImportError('No module %s in %s' % ('.'.join(modpath),
15                                                            '.'.join(imported)))
16              # XXX guess if package is using pkgutil.extend_path by looking for
17              # those keywords in the first four Kbytes
18 -            data = open(join(mp_filename, '__init__.py')).read(4096)
19 -            if 'pkgutil' in data and 'extend_path' in data:
20 -                # extend_path is called, search sys.path for module/packages of this name
21 -                # see pkgutil.extend_path documentation
22 -                path = [join(p, modname) for p in sys.path
23 -                        if isdir(join(p, modname))]
24 +            try:
25 +                data = open(join(mp_filename, '__init__.py')).read(4096)
26 +            except IOError:
27 +                path = [mp_filename]
28              else:
29 -                path = [mp_filename]
30 +                if 'pkgutil' in data and 'extend_path' in data:
31 +                    # extend_path is called, search sys.path for module/packages
32 +                    # of this name see pkgutil.extend_path documentation
33 +                    path = [join(p, modname) for p in sys.path
34 +                            if isdir(join(p, modname))]
35 +                else:
36 +                    path = [mp_filename]
37      return mtype, mp_filename
38 
39  def _is_python_file(filename):
40      """return true if the given filename should be considered as a python file
41 
diff --git a/testlib.py b/testlib.py
@@ -1185,10 +1185,13 @@
42 
43      if sys.version_info >= (3,2):
44          assertItemsEqual = unittest.TestCase.assertCountEqual
45      else:
46          assertCountEqual = unittest.TestCase.assertItemsEqual
47 +        if sys.version_info < (2,7):
48 +            def assertIsNotNone(self, value, *args, **kwargs):
49 +                self.assertNotEqual(None, value, *args, **kwargs)
50 
51  TestCase.assertItemsEqual = deprecated('assertItemsEqual is deprecated, use assertCountEqual')(
52      TestCase.assertItemsEqual)
53 
54  import doctest