import in plugin_base doesn't work on pypy

Issue #3406 resolved
Michael Bayer
repo owner created an issue
    # unitttest has a SkipTest also but pytest doesn't
    # honor it unless nose is imported too...
    from nose import SkipTest
except ImportError:
    from _pytest.runner import Skipped as SkipTest

the _pytest thing doesn't work:

>>>> from _pytest.runner import Skipped as SkipTest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/_pytest/", line 7, in <module>
    import pytest
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/", line 17, in <module>
    _preloadplugins() # to populate pytest.* namespace so help(pytest) works
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/_pytest/", line 58, in _preloadplugins
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/_pytest/", line 67, in get_plugin_manager
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/_pytest/", line 318, in import_plugin
    mod = importplugin(modname)
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/_pytest/", line 370, in importplugin
ImportError: No module named main

this then causes pypy test to fail:

Traceback (most recent call last):
  File "<builtin>/", line 75, in run_toplevel
  File "", line 154, in <module>
  File "", line 150, in run_setup
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/distutils/", line 151, in setup
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/distutils/", line 953, in run_commands
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/distutils/", line 972, in run_command
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/setuptools/command/", line 142, in run
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/setuptools/command/", line 122, in with_project_on_sys_path
  File "/usr/local/src/pypy-2.5.1-osx64/site-packages/setuptools/command/", line 163, in run_tests
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/unittest/", line 94, in __init__
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/unittest/", line 149, in parseArgs
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/unittest/", line 158, in createTests
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/unittest/", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/local/src/pypy-2.5.1-osx64/lib-python/2.7/unittest/", line 100, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: 'module' object has no attribute 'testing'

we need to look at current pytest and see if there's a SkipTest we can use that doesn't require the weird import here

Comments (3)

  1. Log in to comment