I can run python some.code.py
in cli.
But I can not run pytest some.code.py
neither pytest 'some.code.py'
.
The traceback error is
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/local/lib/python3.7/site-packages/_pytest/python.py:501: in _importtestmodule
mod = self.fspath.pyimport(ensuresyspath=importmode)
/usr/local/lib/python3.7/site-packages/py/_path/local.py:701: in pyimport
__import__(modname)
E ModuleNotFoundError: No module named 'some'
I understand that pytest import the file as a module so it does not accept invalid module name. But the file I'm testing is generated programmatically by another app. Is there a way to work around this constrain in pytest?
Aucun commentaire:
Enregistrer un commentaire