[med-svn] [Git][med-team/python-easydev][upstream] 2 commits: New upstream version 0.10.1

Andreas Tille gitlab at salsa.debian.org
Tue Sep 29 09:04:08 BST 2020



Andreas Tille pushed to branch upstream at Debian Med / python-easydev


Commits:
568696c4 by Andreas Tille at 2020-09-29T09:46:50+02:00
New upstream version 0.10.1
- - - - -
6b3cd92f by Andreas Tille at 2020-09-29T09:58:18+02:00
New upstream version 0.10.1+dfsg
- - - - -


30 changed files:

- PKG-INFO
- easydev/__init__.py
- easydev/browser.py
- easydev/config_tools.py
- easydev/console.py
- easydev/copybutton.py
- easydev/decorators.py
- easydev/easytest.py
- easydev/logging_tools.py
- easydev/misc.py
- easydev/multicore.py
- − easydev/multisetup.py
- easydev/package.py
- easydev/paths.py
- easydev/platform.py
- easydev/profiler.py
- easydev/progressbar.py
- easydev/timer.py
- easydev/tools.py
- easydev/url.py
- setup.cfg
- setup.py
- test/test_easytest.py
- test/test_logging_tools.py
- test/test_misc.py
- − test/test_multisetup.py
- test/test_platform.py
- test/test_timer.py
- test/test_tools.py
- test/test_url.py


Changes:

=====================================
PKG-INFO
=====================================
@@ -1,13 +1,14 @@
-Metadata-Version: 1.1
+Metadata-Version: 2.1
 Name: easydev
-Version: 0.9.38
+Version: 0.10.1
 Summary: Common utilities to ease the development of Python packages
-Home-page: ['http://packages.python.org/easydev/']
+Home-page: http://github.com/cokelaer/easydev
 Author: Thomas Cokelaer
 Author-email: thomas.cokelaer at pasteur.fr
+Maintainer: Thomas Cokelaer
+Maintainer-email: thomas.cokelaer at pasteur.fr
 License: new BSD
-Download-URL: ['http://pypi.python.org/pypi/easydev']
-Description-Content-Type: UNKNOWN
+Download-URL: http://github.com/cokelaer/easydev
 Description: easydev
         ##########
         
@@ -58,9 +59,8 @@ Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Science/Research
 Classifier: License :: OSI Approved
 Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
 Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Provides-Extra: profiler


=====================================
easydev/__init__.py
=====================================
@@ -60,7 +60,6 @@ from .sphinx_themes import *
 from . import tools
 from .tools import *
 
-from . import multisetup
 
 from .md5tools import md5
 


=====================================
easydev/browser.py
=====================================
@@ -73,18 +73,18 @@ def browse(url, verbose=True):
     from sys import platform as _platform
     if _platform == "linux" or _platform == "linux2":
         _browse_linux(url, verbose=True)
-    elif _platform == "darwin": 
+    elif _platform == "darwin":  #pragma: no cover
         # under Mac, it looks like the standard  webbrowser may not work as smoothly 
         # OS X
         _browse_mac(url, verbose)
-    elif _platform == "win32":  
+    elif _platform == "win32":  #pragma: no cover
         # for windows and others, the same code as Linux should work
         _browse_linux(url, verbose=True)
     else:
         _browse_linux(url, verbose=True)
 
 
-def _browse_mac(url, verbose=True):
+def _browse_mac(url, verbose=True): #pragma: no cover
     if verbose:
         print("openning %s" % url)
 
@@ -113,7 +113,7 @@ def _browse_mac(url, verbose=True):
             raise Exception
 
 
-def _browse_linux(url, verbose=True):
+def _browse_linux(url, verbose=True): #pragma: no cover
     if verbose:
         print("openning %s" % url)
     try:
@@ -133,7 +133,7 @@ def _browse_linux(url, verbose=True):
     raise Exception("Could not open http://{}".format(url))
 
 
-def main(args=None):
+def main(args=None): #pragma: no cover
     if args is None:
         args = sys.argv[:]
 
@@ -170,6 +170,6 @@ def main(args=None):
             browse("http://"+url, verbose)
 
 
-if __name__ == "__main__":
+if __name__ == "__main__": #pragma: no cover
     import sys
     main(sys.argv)


=====================================
easydev/config_tools.py
=====================================
@@ -47,17 +47,17 @@ class _DictSection(object):
     def get(self, attr, default = None):
         if attr in self:
             return self._config.get(self._section, attr)
-        else:
+        else: #pragma: no cover
             return default
 
     def __setattr__(self, attr, value):
         if attr.startswith('_'):
             object.__setattr__(self, attr, value)
-        else:
+        else: #pragma: no cover
             self.__setitem__(attr, value)
 
     def __setitem__(self, attr, value):
-        if self._section not in self._config:
+        if self._section not in self._config: #pragma: no cover
             self._config.add_section(self._section)
 
         self._config.set(self._section, attr, str(value))
@@ -257,7 +257,7 @@ class DynamicConfigParser(ConfigParser, object):
         .. note:: an integer is cast into an int
         """
         options = {}
-        for option in self.options(section):
+        for option in self.options(section): # pragma no cover
             data = self.get(section, option, raw=True)
             if data.lower() in ['true', 'yes']:
                 options[option] = True
@@ -290,7 +290,7 @@ class DynamicConfigParser(ConfigParser, object):
             if os.path.exists(filename) == True:
                 print("Warning: over-writing %s " % filename)
             fp = open(filename,'w')
-        except Exception as err:
+        except Exception as err: #pragma: no cover
             print(err)
             raise Exception('filename could not be opened')
 
@@ -360,7 +360,7 @@ class DynamicConfigParser(ConfigParser, object):
                         str(data.get(section,option, raw=True)):
                         print("option %s in section %s differ" % (option, section))
                         return False
-                except:
+                except: # pragma: no cover
                     return False
         return True
 
@@ -387,7 +387,7 @@ class CustomConfig(object):
             print("Creating directory %s " % sdir)
             try:
                 self._mkdirs(sdir)
-            except Exception:
+            except Exception: #pragma: no cover
                 print("Could not create the path %s " % sdir)
                 return None
         return sdir
@@ -401,11 +401,11 @@ class CustomConfig(object):
         try:
             sdir = self.appdirs.user_config_dir
             os.rmdir(sdir)
-        except Exception as err:
+        except Exception as err: #pragma: no cover
             raise Exception(err)
 
 
-def _load_configfile(configpath):
+def _load_configfile(configpath): #pragma: no cover
     "Tries to load a JSON or YAML file into a dict."
     try:
         with open(configpath) as f:


=====================================
easydev/console.py
=====================================
@@ -27,7 +27,7 @@ __all__ = ["color_terminal", "get_terminal_width", "term_width_line"]
 from easydev.platform import is_windows
 
 
-if is_windows() is True:
+if is_windows() is True: #pragma: no cover
     import colorama
     colorama.init()
 
@@ -43,7 +43,7 @@ def get_terminal_width():
                            struct.pack('hhhh', 0, 0, 0, 0))
         _, width = struct.unpack('hhhh', call)[:2]
         terminal_width = width
-    except (SystemExit, KeyboardInterrupt):
+    except (SystemExit, KeyboardInterrupt): #pragma: no cover
         raise
     except:
         # FALLBACK
@@ -72,7 +72,7 @@ def color_terminal():
         return False
     if not sys.stdout.isatty():
         return False
-    if 'COLORTERM' in os.environ:
+    if 'COLORTERM' in os.environ: #pragma: no cover
         return True
     term = os.environ.get('TERM', 'dumb').lower()
     if term in ('xterm', 'linux') or 'color' in term:
@@ -80,11 +80,11 @@ def color_terminal():
     return False
 
 
-def __nocolor():
+def __nocolor(): #pragma: no cover
     """set color codes off"""
     codes.clear()
 
-def __coloron():
+def __coloron(): #pragma: no cover
     """Set color codes on"""
     codes.update(_orig_codes)
 


=====================================
easydev/copybutton.py
=====================================
@@ -29,7 +29,7 @@ from os.path import join as pj
 import shutil
 try:
     from docutils import nodes
-except Exception:
+except Exception: #pragma: no cover
     # if docutils is not installed
     class Dummy():
         SkipNode = Exception
@@ -84,7 +84,7 @@ def get_copybutton_path():
         packagedir = easydev.__path__[0]
         packagedir = os.path.realpath(pj(packagedir, 'share'))
         os.listdir(packagedir) # if this faisl, we are in deve mode
-    except OSError:
+    except OSError: #pragma: no cover
         try:
             packagedir = easydev.__path__[0]
             packagedir = os.path.realpath(pj(packagedir, '..', 'share'))
@@ -93,7 +93,7 @@ def get_copybutton_path():
     return pj(packagedir, "copybutton.js")
 
 
-def setup(app):
+def setup(app): # pragma: no cover
     cwd = os.getcwd()
 
     # From Sphinx, we typing "make html", this is the place where we expect
@@ -110,7 +110,7 @@ def setup(app):
         shutil.copy( get_copybutton_path(), staticpath)
 
     # Now that the file is available, use it
-    app.add_javascript('copybutton.js')
+    app.add_js_file('copybutton.js')
 
 
 


=====================================
easydev/decorators.py
=====================================
@@ -152,7 +152,7 @@ def ifpandas(func):
     try:
         import pandas
         return wrapper
-    except Exception:
+    except Exception: #pragma: no cover
         def dummy():
             pass
         return dummy
@@ -170,7 +170,7 @@ def ifpylab(func):
     try:
         import pylab
         return wrapper
-    except Exception:
+    except Exception: #pragma: no cover
         def dummy():
             pass
         return dummy


=====================================
easydev/easytest.py
=====================================
@@ -17,8 +17,6 @@
 ##############################################################################
 # $:Id $
 
-# keep nose inside the functions to avoid dependencies
-
 import tempfile
 
 __all__ = ["assert_list_almost_equal", "trysetattr", "TempFile"]
@@ -43,15 +41,14 @@ def assert_list_almost_equal(first, second, places=None, deltas=None):
         >>> assert_list_almost_equal([0,0,1], [0,0,0.9999], deltas=1e-4)
 
     """
-    from nose.tools import assert_almost_equal
-    for x, y in zip(first, second):
-        # PYTHON 2.6 hack. This assert_almost_equal function
-        # fails but I don't think this is correct. So let us
-        # catch the TypeError
-        try:
-            assert_almost_equal(x, y, places=places, delta=deltas)
-        except TypeError:
-            pass
+    if places:
+        deltas = 10**-(places-1)
+
+
+    if deltas:
+        for x, y in zip(first, second):
+            if abs(x-y)>deltas:
+                raise ValueError
 
 
 def trysetattr(this, attrname, value, possible):
@@ -109,7 +106,7 @@ class TempFile(object):
     def delete(self):
         try:
             self.temp._closer.delete = True
-        except:
+        except: #pragma: no cover
             self.temp.delete = True
         self.temp.close()
 
@@ -120,7 +117,7 @@ class TempFile(object):
     def __exit__(self, type, value, traceback):
         try:
             self.delete()
-        except AttributeError:
+        except AttributeError: #pragma: no cover
             pass
         finally:
             self.delete()


=====================================
easydev/logging_tools.py
=====================================
@@ -41,8 +41,9 @@ class Logging(object):
 
     """
     def __init__(self, name="root", level="WARNING"):
-        self.name = name
-        formatter = colorlog.ColoredFormatter(
+        self.default = name
+        self._name = name
+        self.formatter = colorlog.ColoredFormatter(
              "%(log_color)s%(levelname)-8s[%(name)s]: %(reset)s %(blue)s%(message)s",
              datefmt=None,
              reset=True,
@@ -50,12 +51,23 @@ class Logging(object):
              secondary_log_colors={},
              style='%'
         )
-        handler = colorlog.StreamHandler()
-        handler.setFormatter(formatter)
-        logger = colorlog.getLogger(self.name)
+        self._set_name(name)
+
+
+    def _set_name(self, name):
+        self._name = name
+        logger = colorlog.getLogger(self._name)
         if len(logger.handlers) == 0:
+            handler = colorlog.StreamHandler()
+            handler.setFormatter(self.formatter)
             logger.addHandler(handler)
-            self._set_level(level)
+            if self.level == 0:
+                self.level = "WARNING"
+            else:
+                self._set_level(self.level)
+    def _get_name(self):
+        return self._name
+    name = property(_get_name, _set_name)
 
     def _set_level(self, level):
         if isinstance(level, bool):
@@ -63,7 +75,8 @@ class Logging(object):
                 level = "INFO"
             if level is False:
                 level = "ERROR"
-        assert level in ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]
+        assert level in ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],\
+            "you provided {}".format(level)
         logging_level = getattr(colorlog.logging.logging, level)
         colorlog.getLogger(self.name).setLevel(level)
 


=====================================
easydev/misc.py
=====================================
@@ -27,14 +27,14 @@ def get_home():
     # First, let us try with expanduser
     try:
         homedir = os.path.expanduser("~")
-    except ImportError:
+    except ImportError: #pragma: no cover
         # This may happen.
         pass
     else:
         if os.path.isdir(homedir):
             return homedir
     # Then, with getenv
-    for this in ('HOME', 'USERPROFILE', 'TMP'):
+    for this in ('HOME', 'USERPROFILE', 'TMP'): #pragma: no cover
         # getenv is same as os.environ.get
         homedir = os.environ.get(this)
         if homedir is not None and os.path.isdir(homedir):
@@ -52,7 +52,7 @@ def cmd_exists(cmd):
             return True
         else:
             return False
-    except Exception:
+    except Exception: #pragma: no cover
         # If subprocess is not found, we assume it exists.
         # This choice ensure that if it fails, we keep going.
         return True
@@ -64,7 +64,7 @@ def in_ipynb():
     :return: True if in an ipython notebook otherwise returns False
 
     """
-    try:
+    try:#pragma: no cover
         cfg = get_ipython().config
         if 'parent_appname' in cfg['IPKernelApp'].keys() and \
                 cfg['IPKernelApp']['parent_appname'] == 'ipython-notebook':
@@ -73,5 +73,5 @@ def in_ipynb():
             if "jupyter" in cfg['IPKernelApp']['connection_file']:
                 return True
         return False
-    except NameError:
+    except NameError: #pragma: no cover
         return False


=====================================
easydev/multicore.py
=====================================
@@ -125,7 +125,7 @@ class MultiProcessing(object):
                 if count == len(self.jobs):
                     break
 
-        except KeyboardInterrupt:
+        except KeyboardInterrupt:#pragma: no cover
             print("\nCaught interruption. " + 
             "Terminating the Pool of processes... ",)
             self.pool.terminate()


=====================================
easydev/multisetup.py deleted
=====================================
@@ -1,364 +0,0 @@
-# -*- python -*-
-# -*- coding: utf-8 -*-
-#
-#  This file is part of the easydev software
-#
-#  Copyright (c) 2011-2017
-#
-#  File author(s): Thomas Cokelaer <cokelaer at gmail.com>
-#
-#  Distributed under the GPLv3 License.
-#  See accompanying file LICENSE.txt or copy at
-#      http://www.gnu.org/licenses/gpl-3.0.html
-#
-#  Website: https://github.com/cokelaer/easydev
-#  Documentation: http://easydev-python.readthedocs.io
-#
-##############################################################################
-"""Calling setup.py recursively and/or in multi python packages.
-
-The commands are similar to those expected by setup.py. In addition,
-there are a few commands dedicated to multisetup (see --help).
-
-:Example:
-
-    .. doctest::
-        :options: +SKIP
-
-        >>> python multisetup install --quiet
-        >>> python multisetup install sdist --dist-dir ../dist
-        >>> python multisetup --keep-going install sdist --dist-dir ../dist
-
-
-Based on OpenAlea.Misc http://openalea.gforge.inria.fr
-
-"""
-
-__license__ = "GPLv3"
-__revision__ = "$Id$"
-
-import sys
-import os
-from subprocess import PIPE, Popen
-
-
-try:
-    from easydev.console import bold, red, green, \
-        color_terminal, nocolor, underline, purple
-except ImportError:
-    pass
-
-
-"""
-  args = sys.argv[1:]
-    if  len(args) == 1 and args[0] in ['-h', '--help']:
-        Multisetup.help()
-    else:
-        if 'develop -u' in args:
-            dirs.reverse()
-"""
-
-class Multisetup(object):
-    """The main base class to build Multisetup instances
-
-
-    In practice, you create a python script with this kind of code::
-
-        if __name__ == "__main__"
-            from easydev.multisetup import Multisetup
-            import sys
-            packages = ['pkg1', 'pkg2']
-            mysetup = Multisetup(commands=sys.argv[1:], packages=packages)
-            mysetup.run()
-
-
-    """
-    def __init__(self, commands, packages=None, curdir='.', verbose=True):
-        """.. rubric:: Constructor
-
-        :param commands: list of user commands or command (see :meth:`parse_commands`)
-           accepted commands are --packages, --exclude-packages, -quiet, --keep-going
-        :param list packages: list of packages to process
-        :param str curdir: current directory default is .
-        :param bool verbose: verbose option
-
-        :type commands: a string or list of strings
-
-        The argument `commands` must be a list of strings combining arguments
-        from multisetup and setup.
-
-        :Examples:
-
-        .. doctest::
-            :options: +SKIP
-
-            >>> Multisetup("install --keep-going", ['pkg1', 'pkg2'], '.', verbose=True)
-            >>> Multisetup(["install","--keep-going"], ['pkg1', 'pkg2'], '.', verbose=True)
-
-        """
-        if len(commands) == 1 and commands[0] in ['-h', '--help']:
-            Multisetup.help()
-
-        if 'develop -u' in " ".join(commands):
-            packages.reverse()
-
-        # default
-        self.curdir = os.path.abspath(curdir)
-
-        if isinstance(commands, list):
-            self.commands = list(commands)
-
-        elif isinstance(commands, str):
-            self.commands = list(commands.split(" "))
-        else:
-            raise TypeError("commands argument must be a list of arguments or a string")
-
-        self.packages = list(packages)
-        self.verbose = verbose
-        self.force = False
-
-        # parsing user arguments
-        self.parse_packages()
-
-        # self.parse_intern_commands()
-        self.parse_commands()
-
-
-    @classmethod
-    def help(cls):
-        """help: to get more help and usage
-        """
-        print("""
-
-        MultiSetup allows to build and install all the packages found in this
-        directory usinf the same commands and setuptools.
-
-        Examples:
-        ---------
-
-            # Developer mode : Installation of the pks from svn
-            >>> python multisetup.py develop
-
-            # User mode: Installation of the packages on the system as root
-            >>> python multisetup.py install
-
-            # Administrator mode: Create distribution of the packages
-            >>> python multisetup.py nosetests -w test install bdist_egg -d ../dist sdist -d ../dist
-
-        Common commands:
-          multisetup.py sdist -d ./dist   will create a source distribution underneath 'dist/'
-          multisetup.py install           will install the package
-
-        Global options:
-          --quiet                        do not show setup outputs [default=False]
-          -k, --keep-going               force the commands running[default=False]
-          -h, --help                     show detailed help message
-         --packages                      list of packages to run
-                                         [default: none]
-          --exclude-packages             list of packages to not run
-
-        print "usage: multisetup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
-        """)
-
-
-    def parse_packages(self):
-        """Search and remove package(S) from multisetup command (e.g., --package)
-
-        .. todo:: known issue: python multisetup.py --packages with two
-            packages will be confused by following commands. Must be put
-            at the end of the command
-        """
-        if '--packages' in self.commands:
-            index = self.commands.index('--packages')
-            self.commands.remove('--packages')
-            self.packages = set()
-            found = True
-            while found is True:
-                try: #test is no more argument
-                    self.commands[index]
-                except: # then breaks
-                    break
-                # otherwise if next argument starts with -, break
-                if self.commands[index].startswith('-'):
-                    break
-                # or carry on to gather package names
-                else:
-                    self.packages.add(self.commands[index])
-                    self.commands.remove(self.commands[index])
-                    continue
-            #self.commands.pop(index)
-
-        if '--exclude-packages' in self.commands:
-            # keep track of --exclude-package index
-            index = self.commands.index('--exclude-packages')
-            # remove it from the commands
-            self.commands.remove('--exclude-packages')
-            # remove all packages provided afterwards until next arguments is found
-            found = True
-            while found is True:
-                # look for next argument/package that may be the end of the command
-                try:
-                    package_to_remove = self.commands[index]
-                except:
-                    break
-                # if this is a valid package name
-                if package_to_remove in self.packages:
-                    # remove it from the package list
-                    self.packages.remove(package_to_remove)
-                    # and from the command line
-                    self.commands.remove(package_to_remove)
-                    # until we found another package
-                    continue
-                # otherwise, it is an argument that
-                else:
-                    #starts with a - sign
-                    if package_to_remove.startswith('-'):
-                        break
-                    # or is invalid
-                    raise ValueError('--exclude-packages error: package %s not found in package list' \
-                        % self.commands[index])
-
-            #self.commands.pop(index)
-
-
-    def parse_commands(self):
-        """Search and remove multisetup options
-
-        Get the user command line arguments (self.commands) that are dedicated
-        to multisetup such as --help, --quiet, --keep-going so that the
-        remaining commands are fully comptatible with setuptools.
-        """
-
-        if '--quiet' in self.commands:
-            self.verbose = False
-            self.commands.remove('--quiet')
-
-        if '-k' in self.commands:
-            self.force = True
-            self.commands.remove('-k')
-
-        if '--keep-going' in self.commands:
-            self.force = True
-            self.commands.remove('--keep-going')
-
-        L = len(self.commands)
-        i = 0
-        while (i < L):
-            if self.commands[i].startswith('-'):
-                try:
-                    self.commands[i-1] = self.commands[i-1] + ' ' + self.commands[i] + ' ' + self.commands[i+1]
-                    self.commands.pop(i)
-                    self.commands.pop(i)
-                except:
-                    self.commands[i-1] = self.commands[i-1] + ' ' + self.commands[i]
-                    self.commands.pop(i)
-            else:
-                i += 1
-            L = len(self.commands)
-
-
-    def run(self, color=True):
-        """Executes 'python setup.py' with the user commands on all packages. """
-        if color:
-            try:
-                from easydev.console import bold, red, green, \
-                    color_terminal, nocolor, underline, purple
-            except:
-                try:
-                    sys.path.insert(0, os.path.join('deploy', 'src',  'deploy'))
-                    from console import bold, red, green, \
-                        color_terminal, nocolor, underline, purple
-                except:
-                    pass
-            if not color_terminal():
-                # Windows' poor cmd box doesn't understand ANSI sequences
-                nocolor()
-        else:
-            bold = purple = red = green = underline = str
-
-        print(bold("Running multisetup version %s" % __revision__.split()[2]))
-
-        #project_dir = self.curdir.basename()
-        directories = [package for package in self.packages]
-
-
-        print('Will process the following directories: ',)
-        for directory in directories:
-            print(bold(directory)),
-            #print bold(directory.basename()),
-        print('')
-
-
-        try:
-            for directory in directories:
-                try:
-                    os.chdir(directory)
-                    print(underline('Entering %s package'
-                          % os.path.basename(directory)))
-                          #          % directory.basename())
-                except OSError as err:
-                    print(underline('Entering %s package'
-                              % os.path.basename(directory)))
-                    print(red("cannot find this directory (%s)"
-                              % os.path.basename(directory)))
-                    print(err)
-
-                print('Python exec : ' , sys.executable)
-
-                #print underline('Entering %s package' % directory.basename())
-                for cmd in self.commands:
-                    setup_command = '%s setup.py %s ' % (sys.executable,cmd)
-                    print("\tExecuting " + setup_command + '...processing',)
-
-
-                    #Run setup.py with user commands
-                    outputs = None
-                    errors = None
-                    if self.verbose:
-                        process = Popen(setup_command,
-                                        shell=True)
-                        status = process.wait()
-                    else:
-                        process = Popen(setup_command, stdout=PIPE, stderr=PIPE,
-                                        shell=True)
-                        #status = process.wait()
-                        outputs, errors = process.communicate()
-                    if process.returncode == 0:
-                        print(green('done'))
-                    else:
-                        if not self.verbose:
-                            print(red('\tFailed. ( error code %s) ' %
-                                  (process.returncode)))
-                            os.chdir(self.curdir)
-
-                        if not self.force:
-                            raise RuntimeError()
-
-                    if 'pylint' in cmd:
-                        if outputs is not None:
-                            for x in outputs.split('\n'):
-                                if x.startswith('Your code has been'):
-                                    print(purple('\t%s' % x))
-                    if 'nosetests' in cmd:
-                        if errors is not None:
-                            for x in errors.split('\n'):
-                                if x.startswith('TOTAL'):
-                                    res = x.replace('TOTAL', 'Total coverage')
-                                    res = " ".join (res.split())
-                                    print(purple('\t%s' % res))
-                                if x.startswith('Ran'):
-                                    print(purple('\t%s' % x))
-                                if x.startswith('FAILED'):
-                                    print(purple('\t%s' % x))
-                        else:
-                            print(purple('all right'))
-
-                os.chdir(self.curdir)
-
-        except RuntimeError:
-            sys.exit()
-
-        os.chdir(self.curdir)
-
-
-


=====================================
easydev/package.py
=====================================
@@ -264,7 +264,7 @@ class PackageBuilder(object):
             os.mkdir(self.pkgname)
             return True
 
-    def create_namespace(self):
+    def create_namespace(self): #pragma: no cover
         if self.namespace == None:
             self.logging.warning("namespace is not set, cannot create namespace directories")
             return


=====================================
easydev/paths.py
=====================================
@@ -73,7 +73,7 @@ def get_shared_directory_path(package):
         # looks like we have found the share directory so it is an install mode
         #print ("yes")
         return sharedir
-    else:
+    else: #pragma: no cover
         #print("no. searching for share dir as if in develop mode")
         # let us try a couple of directories
         # FIXME: do we need the 3 cases ??


=====================================
easydev/platform.py
=====================================
@@ -18,21 +18,11 @@
 from __future__ import absolute_import # avoids conflict with standard module
 import os
 import sys
-import platform as plf
 
-__all__ = ["get_platform", "linux_distribution", ""]
-
-def linux_distribution():
-    try:
-        # Note that this module has the same name as the standard module
-        # hence the renaming of the standard module here below
-        return plf.linux_distribution()
-    except Exception as err:
-        print(err)
-        return "unknown"
+__all__ = ["get_platform"]
 
 
-def get_platform():
+def get_platform(): #pragma: no cover
     """Identify the platform (Linux/windows/Mac)
 
     The folloing modules/functions can be used to identify the platform:
@@ -47,6 +37,7 @@ def get_platform():
         can be determined otherwise, the content of sys.platform()
 
     """
+    print("Will be deprecated in future version of easydev")
     try:
         platform = plf.system()
         return platform


=====================================
easydev/profiler.py
=====================================
@@ -53,7 +53,7 @@ try:
                     profiler.print_stats()
             return profiled_func
         return inner
-except ImportError:
+except ImportError: # pragma: no cover
     def do_profile(follow=[]):
         "Helpful if you accidentally leave in production!"
         print("easydev warning:: line_profiler does not seem to be installed. " + 


=====================================
easydev/progressbar.py
=====================================
@@ -25,7 +25,7 @@ import uuid
 
 try:
     from IPython.core.display import HTML, Javascript, display
-except ImportError:
+except ImportError: #pragma: no cover
     pass
 
 
@@ -48,7 +48,7 @@ class ProgressBar(object):
     def _percentage(self, i):
         if self.iterations !=0:
             return 100 * i / float(self.iterations)
-        else:
+        else: #pragma: no cover
             # could be 100 ?
             return 100
 
@@ -67,7 +67,7 @@ class TextProgressBar(ProgressBar):
 
     def animate(self, i, dummy=None):
         # dummy=None is for back-compatibility
-        if dummy is not None:
+        if dummy is not None: #pragma: no cover
             print("second argument in easydev.progress_bar.animate is deprecated. Update your code")
         # +1 if i starts at 0 and finishes at N-1
         if divmod(i, self.interval)[1] != 0 and i != self.iterations:
@@ -104,12 +104,12 @@ def consoleprint(s):
         sys.stdout.flush()
 
 
-def ipythonprint(s):
+def ipythonprint(s): #pragma no cover
     print('\r', s, end='')
     sys.stdout.flush()
 
 
-class IPythonNotebookPB(ProgressBar):
+class IPythonNotebookPB(ProgressBar): #pragma: no cover
     """Use :class:`Progress`"""
     def __init__(self, iterations, interval=None):
         self.divid = str(uuid.uuid4())
@@ -170,7 +170,7 @@ def progress_bar(iters, interval=None):
             pb.animate(i)
 
     """
-    if _run_from_ipython():
+    if _run_from_ipython(): #pragma: no cover
         from easydev.misc import in_ipynb
         if in_ipynb() is True:
             return IPythonNotebookPB(iters, interval=interval)


=====================================
easydev/timer.py
=====================================
@@ -19,7 +19,7 @@
 import time
 
 
-class Timer(object):
+class Timer(object): #pragma: no cover
     """Timer working with *with* statement
 
     ::


=====================================
easydev/tools.py
=====================================
@@ -26,7 +26,7 @@ __all__ = ["shellcmd", "swapdict", "check_param_in_list",
     "touch", "mkdirs"]
 
 
-def precision(data, digit=2):
+def precision(data, digit=2): 
     """Round values in a list keeping only N digits precision
 
     ::


=====================================
easydev/url.py
=====================================
@@ -25,7 +25,7 @@ except ImportError:
 __all__ = ["isurl_reachable"]
 
 
-def isurl_reachable(url, timeout=10, path="/"):
+def isurl_reachable(url, timeout=10, path="/"): #pragma: no cover
     """Checks if an URL exists or nor
 
     :param str url: the url to look for


=====================================
setup.cfg
=====================================
@@ -7,7 +7,7 @@ all_files = 1
 upload_dir = doc/build/html/
 
 [tool:pytest]
-addopts = --cov=easydev --cov-report=term-missing --durations=10 --verbose
+addopts = --cov=easydev --cov-report=term-missing  --verbose
 
 [egg_info]
 tag_build = 


=====================================
setup.py
=====================================
@@ -6,8 +6,8 @@ from setuptools import setup, find_packages
 import glob
 
 _MAJOR               = 0
-_MINOR               = 9
-_MICRO               = 38
+_MINOR               = 10
+_MICRO               = 1
 version              = '%d.%d.%d' % (_MAJOR, _MINOR, _MICRO)
 release              = '%d.%d' % (_MAJOR, _MINOR)
 
@@ -15,8 +15,8 @@ metainfo = {
     'authors': {'Cokelaer':('Thomas Cokelaer','thomas.cokelaer at pasteur.fr')},
     'version': version,
     'license' : 'new BSD',
-    'download_url' : ['http://pypi.python.org/pypi/easydev'],
-    'url' : ["http://packages.python.org/easydev/"],
+    'download_url' :'http://github.com/cokelaer/easydev',
+    'url' : "http://github.com/cokelaer/easydev",
     'description':'Common utilities to ease the development of Python packages' ,
     'platforms' : ['Linux', 'Unix', 'MacOsX', 'Windows'],
     'keywords' : ["package", "multisetup", "logging", "config", "decorators",
@@ -27,11 +27,9 @@ metainfo = {
           'Intended Audience :: Science/Research',
           'License :: OSI Approved',
           'Operating System :: OS Independent',
-          'Programming Language :: Python :: 2',
-          'Programming Language :: Python :: 2.7',
-          'Programming Language :: Python :: 3',
-          'Programming Language :: Python :: 3.4',
           'Programming Language :: Python :: 3.5',
+          'Programming Language :: Python :: 3.6',
+          'Programming Language :: Python :: 3.7',
           'Topic :: Software Development :: Libraries :: Python Modules'
           ]
     }
@@ -70,6 +68,7 @@ setup(
     extras_require = {
 	    'profiler': ["line_profiler_test"]
     },
+    tests_require=['pytest'],
     # somehow, the google_head.html is found in themes/standard and themese/cno
     # directories thanks to the contents of datafiles variable but the ones from
     # themes/standard directory are not copied inside the distribution ?


=====================================
test/test_easytest.py
=====================================
@@ -23,9 +23,20 @@ def test_tempfile():
 
 
 def test_list_almost_equal():
-    assert_list_almost_equal([1,2],[1,2])
+    assert_list_almost_equal([1,2], [1,2])
     try:
-        assert_list_almost_equal([1,2],[1,3])
+        assert_list_almost_equal([1,2], [1,3])
         assert False
     except:
         assert True
+        
+
+    assert_list_almost_equal([1,1], [1, 0.9999], places=3)
+    assert_list_almost_equal([1,1], [1, 0.9999], deltas=1e-4)
+    try:
+        assert_list_almost_equal([1,1], [1, 0.9999], deltas=1e-5)
+        assert False
+    except:
+        assert True
+
+test_list_almost_equal()


=====================================
test/test_logging_tools.py
=====================================
@@ -4,13 +4,16 @@ from easydev import Logging
 def test_logging():
 
     l = Logging("INFO")
-
+    l.name = "test"
     l.info("test")
-    l.level = "WARNING"
-    l.level == "INFO"
-    l.level == "CRITICAL"
-    l.level == "ERROR"
-    l.level == "DEBUG"
+    l.debug("test")
+    l.warning("test")
+    l.error("test")
+    l.critical("test")
+
+    for level in ['DEBUG', 'INFO', 'ERROR', 'WARNING', 'CRITICAL']:
+        l.level = level
+        assert l.level == level
     l.level = True
     l.level = False
 


=====================================
test/test_misc.py
=====================================
@@ -1,6 +1,5 @@
 from easydev.misc import get_home, cmd_exists, in_ipynb
 #from mock import patch
-import nose.tools
 import subprocess
 import os.path
 


=====================================
test/test_multisetup.py deleted
=====================================
@@ -1,83 +0,0 @@
-"""Test make_develop for Multisetup object"""
-import os
-from easydev.multisetup import Multisetup
-from nose import with_setup
-
-"""!!For the following test, don't use intrusive commands such as install 
-together with run method. !!!!"""
-
-curdir = '..' + os.sep + '..'
-
-packages = ['easydev']
-def test_init():
-    """ Test initialization of Multisetup object """
-    mysetup = Multisetup(curdir=curdir, commands='build', packages=packages)
-    assert mysetup.commands == ['build']
-    assert len(mysetup.packages) == 1
-    assert mysetup.packages == packages
-
-
-def _test_wrong_package():
-    mysetup = Multisetup(curdir=curdir, 
-                         commands=['build', '--packages','corezzz'],
-                         packages=['corezzz'])
-    try:
-        mysetup.run()
-        assert False
-    except:
-        assert True
-
-
-def test_parse_packages():
-    """ Test of parse_packages() method with option --packages"""
-    mysetup = Multisetup(curdir=curdir, commands='dummy', packages=packages)
-    mysetup.commands = ['build', '--packages', 'easydev']
-    mysetup.parse_packages()
-    assert mysetup.packages ==  set(['easydev'])
-
-
-def test_parse_no_packages():
-    """ Test of parse_packages() method with option --exclude-package"""
-
-    mysetup = Multisetup(curdir=curdir, 
-                         commands='commands --exclude-packages easydev', 
-                         packages=packages)
-
-    print(mysetup.packages)
-    assert mysetup.packages == []
-
-
-def test_parse_commands():
-    """ Test of parse_commands() method"""
-    commands =['install', 'sdist', '-d', './dist', '--quiet', '--keep-going']
-    mysetup = Multisetup(curdir=curdir, commands=commands, packages=[])
-
-
-    mysetup.parse_commands()
-    mysetup.parse_packages()
-
-
-    assert len(mysetup.commands) == 2
-    assert mysetup.commands[0] == 'install'
-    assert mysetup.commands[1] == 'sdist -d ./dist'
-    assert mysetup.verbose == False
-    assert mysetup.force == True 
-
-
-def test_setup_failure():
-    """ Test of run() method with bad option"""
-    commands = '--packages easydev sdist --bad-option'
-    mysetup = Multisetup(curdir=curdir, commands=commands, packages=['easydev'])
-
-    try:
-        mysetup.run()
-        assert False
-    except:
-        assert True
-
-
-
-
-
-
-


=====================================
test/test_platform.py
=====================================
@@ -1,5 +1,5 @@
 import easydev
-from easydev.platform import get_platform, linux_distribution, is_windows
+from easydev.platform import get_platform, is_windows
 from easydev.platform import is_linux, is_mac
 
 
@@ -7,7 +7,6 @@ def test_platform(mocker):
 
     assert get_platform() in ['Linux', 'Windows', 'Mac']
 
-    linux_distribution()
 
     is_windows()
     is_linux()


=====================================
test/test_timer.py
=====================================
@@ -9,3 +9,5 @@ def test_timer():
         time.sleep(.1)
     assert len(times) == 1
     assert sum(times) <1
+
+    tt = Timer(times)


=====================================
test/test_tools.py
=====================================
@@ -1,4 +1,5 @@
-from easydev import tools, TempFile
+from easydev import tools as tools
+from easydev import TempFile
 
 
 def test_check_range():


=====================================
test/test_url.py
=====================================
@@ -1,5 +1,5 @@
 from easydev import isurl_reachable
-from nose.plugins.attrib import attr
+#from nose.plugins.attrib import attr
 
 
 def test_isurl():



View it on GitLab: https://salsa.debian.org/med-team/python-easydev/-/compare/c7a097f335cc53b75c613e577c372426cc591a4c...6b3cd92f1089391f85469ee51ce26dba75c7137a

-- 
View it on GitLab: https://salsa.debian.org/med-team/python-easydev/-/compare/c7a097f335cc53b75c613e577c372426cc591a4c...6b3cd92f1089391f85469ee51ce26dba75c7137a
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20200929/2d89cd29/attachment-0001.html>


More information about the debian-med-commit mailing list