Skip to content

Commit

Permalink
Define create_module()/exec_module() in AssertionRewritingHook to avo…
Browse files Browse the repository at this point in the history
…id ImportWarning

    __________ ERROR collecting testing/python/show_fixtures_per_test.py ___________
    /usr/lib/python3.10/site-packages/py/_path/local.py:704: in pyimport
        __import__(modname)
    <frozen importlib._bootstrap>:1026: in _find_and_load
        ???
    <frozen importlib._bootstrap>:1005: in _find_and_load_unlocked
        ???
    <frozen importlib._bootstrap>:681: in _load_unlocked
        ???
    E   ImportWarning: AssertionRewritingHook.exec_module() not found; falling back to load_module()
    !!!!!!!!!!!!!!!!!!! Interrupted: 59 errors during collection !!!!!!!!!!!!!!!!!!!
    =========================== 59 error in 3.65 seconds ===========================
  • Loading branch information
hroncok committed Jan 11, 2021
1 parent da7ca9e commit 4406319
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,12 @@ def load_module(self, name):
raise
return sys.modules[name]

def create_module(self, spec):
return self.load_module(spec.name)

def exec_module(self, module):
pass

def is_package(self, name):
try:
fd, fn, desc = self._imp_find_module(name)
Expand Down

0 comments on commit 4406319

Please sign in to comment.