You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running into an issue with the latest version of pytest that was mentioned previously here #2287 and here #2132. Specifically with python 3.6.3 and pytest 3.7.2, the pytest command fails because it can't import anything properly. Critically, this is not an issue if I use pytest==3.6.1. This error is consistent on my local platform (Mac OS 10.11), on travis using a python 3.6 environment, and on a separate linux machine. It's currently breaking Travis CI for at least 2 other projects I develop/contribute to unless I specifically tell Travis to use pytest==3.6.1:
Running python -m pytest doesn't seem to work either. Is there a different way that testing should be conducted on newer version of pytest? Or some additional setup required? I've included just a log of testing on my local machine below with the pymer4 project, but am happy to include any more info required to help solve the issue.
Thanks in advance.
================================================ test session starts =================================================
platform darwin -- Python 3.6.3, pytest-3.7.2, py-1.5.4, pluggy-0.7.1
rootdir: /Users/Esh/Documents/Python/Cosan/pymer4, inifile:
collected 10 items
pymer4/tests/test_models.py EEEEEEEE [ 80%]
pymer4/tests/test_simulate.py EE [100%]
======================================================= ERRORS =======================================================
_________________________________________ ERROR at setup of test_gaussian_lm _________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x105407bf8>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
________________________________________ ERROR at setup of test_gaussian_lmm _________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x1104428c8>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
__________________________________________ ERROR at setup of test_post_hoc ___________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110609ae8>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
________________________________________ ERROR at setup of test_logistic_lmm _________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110609730>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
____________________________________________ ERROR at setup of test_anova ____________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x1104428c8>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
_________________________________________ ERROR at setup of test_poisson_lmm _________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110442f28>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
__________________________________________ ERROR at setup of test_gamma_lmm __________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110609620>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
____________________________________ ERROR at setup of test_inverse_gaussian_lmm _____________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110621730>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
_________________________________________ ERROR at setup of test_simulate_lm _________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110609730>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
________________________________________ ERROR at setup of test_simulate_lmm _________________________________________
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
> mod = self.fspath.pyimport(ensuresyspath=importmode)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:476:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = local('/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'), modname = 'pymer4.pymer4'
ensuresyspath = 'prepend'
def pyimport(self, modname=None, ensuresyspath=True):
""" return path as an imported python module.
If modname is None, look for the containing package
and construct an according module name.
The module will be put/looked up in sys.modules.
if ensuresyspath is True then the root dir for importing
the file (taking __init__.py files into account) will
be prepended to sys.path if it isn't there already.
If ensuresyspath=="append" the root dir will be appended
if it isn't already contained in sys.path.
if ensuresyspath is False no modification of syspath happens.
"""
if not self.check():
raise py.error.ENOENT(self)
pkgpath = None
if modname is None:
pkgpath = self.pypkgpath()
if pkgpath is not None:
pkgroot = pkgpath.dirpath()
names = self.new(ext="").relto(pkgroot).split(self.sep)
if names[-1] == "__init__":
names.pop()
modname = ".".join(names)
else:
pkgroot = self.dirpath()
modname = self.purebasename
self._ensuresyspath(ensuresyspath, pkgroot)
> __import__(modname)
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/py/_path/local.py:668: ModuleNotFoundError
During handling of the above exception, another exception occurred:
self = <CallInfo when='setup' exception: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/py...re your test modules/packages have valid Python names.
Traceback:
ModuleNotFoundError: No module named 'pymer4.pymer4'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x110621c80>, when = 'setup'
treat_keyboard_interrupt_as_exception = False
def __init__(self, func, when, treat_keyboard_interrupt_as_exception=False):
#: context of invocation: one of "setup", "call",
#: "teardown", "memocollect"
self.when = when
self.start = time()
try:
> self.result = func()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:201:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:183: in <lambda>
lambda: ihook(item=item, **kwds),
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/hooks.py:258: in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:67: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/Users/Esh/anaconda3/lib/python3.6/site-packages/pluggy/manager.py:61: in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:104: in pytest_runtest_setup
item.session._setupstate.prepare(item)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:366: in prepare
py.builtin._reraise(*col._prepare_exc)
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/runner.py:370: in prepare
col.setup()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:523: in setup
setup_module = _get_xunit_setup_teardown(self.obj, "setUpModule")
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:269: in fget
self._obj = obj = self._getobj()
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:466: in _getobj
return self._importtestmodule()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Package '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4'>
def _importtestmodule(self):
# we assume we are only called once per module
importmode = self.config.getoption("--import-mode")
try:
mod = self.fspath.pyimport(ensuresyspath=importmode)
except SyntaxError:
raise self.CollectError(
_pytest._code.ExceptionInfo().getrepr(style="short")
)
except self.fspath.ImportMismatchError:
e = sys.exc_info()[1]
raise self.CollectError(
"import file mismatch:\n"
"imported module %r has this __file__ attribute:\n"
" %s\n"
"which is not the same as the test file we want to collect:\n"
" %s\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules" % e.args
)
except ImportError:
from _pytest._code.code import ExceptionInfo
exc_info = ExceptionInfo()
if self.config.getoption("verbose") < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = safe_str(exc_repr)
raise self.CollectError(
"ImportError while importing test module '{fspath}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
> "{traceback}".format(fspath=self.fspath, traceback=formatted_tb)
)
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/Users/Esh/Documents/Python/Cosan/pymer4/pymer4/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E ModuleNotFoundError: No module named 'pymer4.pymer4'
/Users/Esh/anaconda3/lib/python3.6/site-packages/_pytest/python.py:508: CollectError
============================================== 10 error in 3.69 seconds ==============================================
The text was updated successfully, but these errors were encountered:
I'm running into an issue with the latest version of pytest that was mentioned previously here #2287 and here #2132. Specifically with python 3.6.3 and pytest 3.7.2, the
pytest
command fails because it can't import anything properly. Critically, this is not an issue if I usepytest==3.6.1
. This error is consistent on my local platform (Mac OS 10.11), on travis using a python 3.6 environment, and on a separate linux machine. It's currently breaking Travis CI for at least 2 other projects I develop/contribute to unless I specifically tell Travis to usepytest==3.6.1
:https://github.com/ejolly/pymer4
https://github.com/cosanlab/nltools
Running
python -m pytest
doesn't seem to work either. Is there a different way that testing should be conducted on newer version of pytest? Or some additional setup required? I've included just a log of testing on my local machine below with the pymer4 project, but am happy to include any more info required to help solve the issue.Thanks in advance.
The text was updated successfully, but these errors were encountered: