Skip to content

Commit

Permalink
Merge pull request #3 from cocodrips/0.2.0
Browse files Browse the repository at this point in the history
0.2.0
  • Loading branch information
cocodrips authored Feb 6, 2019
2 parents 73886fb + 369e603 commit 8e61007
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doccov/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
doccov
"""
__version__ = '0.1.1'
__version__ = '0.2.0'
name = "doc-cov"

from .main import walk, summary
10 changes: 8 additions & 2 deletions doccov/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,22 @@ def walk(root_path):
coverages = []
summary = Coverage()
for importer, modname, ispkg in packages:
spec = pkgutil._get_spec(importer, modname)
try:
object = importlib._bootstrap._load(spec)
if ispkg:
spec = pkgutil._get_spec(importer, modname)
object = importlib._bootstrap._load(spec)
else:
import_path = f"{package_name}.{modname}"
object = importlib.import_module(import_path)
counter = count_module(object)

coverages.append(counter)
summary += counter
except ImportError as e:
logger.error(f"Failed to import {modname}: {e}")
continue
except Exception as e:
continue

summary.name = 'coverage'
return coverages, summary
Expand Down
2 changes: 1 addition & 1 deletion tests/sample_project/module_fulldoc.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Full document module."""
from sample_project import package_A
from . import package_A
import logging # unused

class FullDoc():
Expand Down

0 comments on commit 8e61007

Please sign in to comment.