Commits

Meme Dough  committed 336cec6

Python 3 support.

  • Participants
  • Parent commits b73da2f
  • Tags RELEASE_0_3

Comments (0)

Files changed (2)

File pytest_cover/pytest_cover.py

 No doubt others have contributed to these tools as well.
 """
 
+try:
+    from functools import reduce
+except ImportError:
+    pass
 import sys
 import os
 
                 if len(self.covers) > 1:
                     suffix = '_'.join(node_descs)
                     replacements = [(' ', '_'), (',', ''), ('.', ''), ('-', '')]
-                    suffix = reduce(lambda suffix, (old, new): suffix.replace(old, new), replacements, suffix)
+                    suffix = reduce(lambda suffix, oldnew: suffix.replace(oldnew[0], oldnew[1]), replacements, suffix)
 
                 if cover_annotate:
                     dir = '%s_%s' % (cover_annotate_dir, suffix) if suffix else cover_annotate_dir
             path_rewrites.append((str(session.config.topdir), str(session.config.slaveinput['coverage_master_topdir'])))
 
             def rewrite_path(filename):
-                return reduce(lambda filename, (slave_path, master_path): filename.replace(slave_path, master_path),
+                return reduce(lambda filename, slavemaster: filename.replace(slavemaster[0], slavemaster[1]),
                               path_rewrites,
                               filename)
             lines = dict((rewrite_path(filename), data) for filename, data in self.cover.data.lines.items())
 from setuptools import setup
 
 setup(name='pytest-cover',
-      version='0.2',
+      version='0.3',
       description='py.test plugin for coverage collection with support for both centralised and distributed testing',
       long_description=pytest_cover.__doc__.strip(),
       author='Meme Dough',