-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanism
Description
I have some code that examines modules and am getting test failures with pkgutil.get_loader() returning
AssertionRewritingHook objects instead of a pkgutil.ImpLoader instance.
This is with user-installed pytest 3.1.2 on Fedora 25 (Python 3.5.3)
Here's an example which demonstrates the problem.
Running pytest against it generates the error:
AttributeError: 'AssertionRewritingHook' object has no attribute 'get_filename'
import os
import pkgutil
import unittest
def get_path(modname):
path = None
loader = pkgutil.get_loader(modname)
if loader:
path = os.path.dirname(loader.get_filename())
return path
class TestGetPath(unittest.TestCase):
def test_load_entry_point_module(self):
self.assertEqual(get_path(__name__), os.path.dirname(__file__))Erotemic, brandonwillard and Jasha10
Metadata
Metadata
Assignees
Labels
topic: rewriterelated to the assertion rewrite mechanismrelated to the assertion rewrite mechanism