From ee5b836e2777118d0ff6dd2adbf605c3bbf8a464 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 10 Oct 2013 17:39:37 -0400 Subject: [PATCH] Implement suggestions by HPK --- _pytest/assertion/rewrite.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index 1f05fc51c..a61ba9651 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -173,10 +173,11 @@ class AssertionRewritingHook(object): @classmethod def _register_with_pkg_resources(cls): """ - Ensure package resources can be loaded from this loader. + Ensure package resources can be loaded from this loader. May be called + multiple times, as the operation is idempotent. """ try: - pkg_resources = __import__('pkg_resources') + import pkg_resources # access an attribute in case a deferred importer is present pkg_resources.__name__ except ImportError: