未验证 提交 9058ce6b 编写于 作者: A Amador Pahim

Merge branch 'clebergnu-test_without_a_file'

......@@ -263,11 +263,14 @@ class Test(unittest.TestCase):
"""
Returns the name of the file (path) that holds the current test
"""
possibly_compiled = inspect.getfile(self.__class__)
if possibly_compiled.endswith('.pyc') or possibly_compiled.endswith('.pyo'):
source = possibly_compiled[:-1]
else:
source = possibly_compiled
try:
possibly_compiled = inspect.getfile(self.__class__)
if possibly_compiled.endswith('.pyc') or possibly_compiled.endswith('.pyo'):
source = possibly_compiled[:-1]
else:
source = possibly_compiled
except TypeError:
return None
if os.path.exists(source):
return source
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册