Python 3.1.2 "All tests in folder" running problem Follow
I've got a problem with running unittest's in "All tests in folder" mode (using Python 3.1.2).
F.e. i have only one file called "test_something.py" in "tests" subfolder of my project:
__author__ = 'iam'
import unittest
class MyTestCase(unittest.TestCase):
def test_something(self):
self.assertEqual(True, True)
if __name__ == '__main__':
unittest.main()
Test runs well when i set Python 2.7 interpreter in configuration, but when i set Python 3.1 i get the following:
No tests were found.
C:/Python31/python.exe "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py" C:/Users/me/PycharmProjects/MyProj/tests/
Testing started at 10:19 ...
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py", line 58, in <module>
modules = loadModulesFromFolderRec(a[0])
File "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py", line 42, in loadModulesFromFolderRec
os.path.walk(folder, walkModules, modules)
AttributeError: 'module' object has no attribute 'walk'
Process finished with exit code 1
Empty test suite.
Is it PyCharm bug or i do something wrong way?
Please sign in to leave a comment.
Hello Alexey,
Yes, this is a bug in PyCharm. I've filed a YouTrack issue: http://youtrack.jetbrains.net/issue/PY-2124
You can watch it to get notified when the problem is resolved.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
Hi Dmitry,
I have observed a simliar (maybe the same?) issue with Python 2.7.
PyCharm fails at reading the standard lib zip module. When running my module "odp_converter.py" stand-alone, the error does not occur.
Here's the output from the test console in PyCharm:
C:/Python27/python.exe "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py" "C:/Users/Jan/Desktop/Integrations-System - Kopie/Source/ipdm/tests/"
Testing started at 15:23 ...
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py", line 58, in <module>
modules = loadModulesFromFolderRec(a[0])
File "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py", line 42, in loadModulesFromFolderRec
os.path.walk(folder, walkModules, modules)
File "C:\Python27\lib\ntpath.py", line 259, in walk
func(arg, top, names)
File "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py", line 38, in walkModules
modules.append(loadSource(os.path.join(dirname, name)))
File "C:\Program Files (x86)\JetBrains\PyCharm 1.0\helpers\pycharm\utrunner.py", line 31, in loadSource
module = imp.load_source(moduleName, fileName)
File "C:/Users/Jan/Desktop/Integrations-System - Kopie/Source/ipdm/tests/test_items.py", line 4, in <module>
import ipdm.utils.odp_converter as odp_converter
File "C:\Users\Jan\Desktop\Integrations-System\Source\ipdm\utils\odp_converter.py", line 3, in <module>
import zipfile
File "C:\Python27\lib\zipfile.py", line 456, in <module>
class ZipExtFile(io.BufferedIOBase):
AttributeError: 'module' object has no attribute 'BufferedIOBase'
Process finished with exit code 1
Empty test suite.
Cheers,
Jan
Hello Jan,
This is a related issue, but not the same one. I've filed http://youtrack.jetbrains.net/issue/PY-2131
for this problem.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"