Pythoscope, the unit test generator

pythoscope generate crashes with AttributeError: 'TestModule' object has no attribute 'testable_objects'

Reported by GrigGheorghiu on 2008-09-03
4
Affects Status Importance Assigned to Milestone
Pythoscope
Medium
Michal Kwiatkowski

Bug Description

I have a collection of .py files that I want to be inspected by pythoscope, and unit test modules to be generated. Here's what I did (the test_blah.py modules are ones that I had already written):

[root@storm deploy]# ls
deploy_activemq.py deploy_cdp_db_mysql.py deploy_lamp_web.py run_test.sh test_mysql.py
deploy_cdp_app.py deploy_cdp_java.py install_log4j.sh show_slave_status.sql test_os.py
deploy_cdp_db_cluster.py deploy_cdp_media.py libdeploy.py test_apache.py test_tomcat.py
deploy_cdp_db_mysql_5.0.45.py deploy_cdp_util_tomcat.py libtest.py test_media.py
[root@storm deploy]# pythoscope inspect *.py
[root@storm deploy]# pythoscope generate -t nose *.py
Traceback (most recent call last):
  File "/usr/bin/pythoscope", line 7, in ?
    sys.exit(
  File "/usr/lib/python2.4/site-packages/pythoscope-0.2.2-py2.4.egg/pythoscope/__init__.py", line 137, in main
    generate(appname, args)
  File "/usr/lib/python2.4/site-packages/pythoscope-0.2.2-py2.4.egg/pythoscope/__init__.py", line 102, in generate
    add_tests_to_project(project, args, destdir, template, force)
  File "/usr/lib/python2.4/site-packages/pythoscope-0.2.2-py2.4.egg/pythoscope/generator.py", line 112, in add_tests_to_project
    generator.add_tests_to_project(project, modnames, destdir, force)
  File "/usr/lib/python2.4/site-packages/pythoscope-0.2.2-py2.4.egg/pythoscope/generator.py", line 58, in add_tests_to_project
    self._add_tests_for_module(module, project, destdir, force)
  File "/usr/lib/python2.4/site-packages/pythoscope-0.2.2-py2.4.egg/pythoscope/generator.py", line 61, in _add_tests_for_module
    test_cases = self._generate_test_cases(module)
  File "/usr/lib/python2.4/site-packages/pythoscope-0.2.2-py2.4.egg/pythoscope/generator.py", line 67, in _generate_test_cases
    [self._generate_test_case(obj, module) \
AttributeError: 'TestModule' object has no attribute 'testable_objects'

Related branches

Michal Kwiatkowski (ruby) wrote :

Basically the problem is that you have test modules there and by calling "pythoscope generate -t nose *.py" you try to generate test cases for them. If you exclude those test modules from call to generate Pythoscope won't crash.

But of course Pythoscope should handle that and just ignore the test modules, so I'm confirming the bug.

Changed in pythoscope:
assignee: nobody → ruby
importance: Undecided → Medium
milestone: none → static-analysis
status: New → Confirmed
Michal Kwiatkowski (ruby) wrote :

Fixed in r103.

Changed in pythoscope:
status: Confirmed → Fix Committed
Michal Kwiatkowski (ruby) wrote :

Fix released with Pythoscope 0.3.

Changed in pythoscope:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers