Pythoscope, the unit test generator

pythoscope crashes if .pythoscope/project.pickle exists

Reported by Kent Tenney on 2008-09-18
4
Affects Status Importance Assigned to Milestone
Pythoscope
Medium
Michal Kwiatkowski

Bug Description

pythoscope runs once after
$ pythoscope --init

next time::

Ups, it seems internal Pythoscope error occured. Please file a bug report at https://bugs.launchpad.net/pythoscope

Traceback (most recent call last):
  File "/usr/bin/pythoscope", line 8, in <module>
    load_entry_point('pythoscope==0.3', 'console_scripts', 'pythoscope')()
  File "/usr/lib/python2.5/site-packages/pythoscope-0.3-py2.5.egg/pythoscope/__init__.py", line 154, in main
    generate_tests(args, force, template)
  File "/usr/lib/python2.5/site-packages/pythoscope-0.3-py2.5.egg/pythoscope/__init__.py", line 92, in generate_tests
    project = Project.from_directory(find_project_directory(modules[0]))
  File "/usr/lib/python2.5/site-packages/pythoscope-0.3-py2.5.egg/pythoscope/store.py", line 110, in from_directory
    project = pickle.load(fd)
  File "/usr/lib/python2.5/pickle.py", line 1370, in load
    return Unpickler(file).load()
  File "/usr/lib/python2.5/pickle.py", line 858, in load
    dispatch[key](self)
  File "/usr/lib/python2.5/pickle.py", line 1133, in load_reduce
    value = func(*args)
TypeError: __init__() takes exactly 5 arguments (2 given)

Related branches

Michal Kwiatkowski (ruby) wrote :

I need more information to reproduce this bug. It looks like the pickle module cannot unpickle some value stored during the first run. Could you show the code you were using pythoscope on?

Changed in pythoscope:
assignee: nobody → ruby
importance: Undecided → Medium
milestone: none → dynamic-analysis
status: New → Incomplete

Michal,

I trimmed the module down, this bit is still giving the traceback
the second time I run

pythoscope test4.py

Thanks,
Kent

On Thu, Sep 18, 2008 at 4:57 PM, Michal Kwiatkowski
<email address hidden> wrote:
> I need more information to reproduce this bug. It looks like the pickle
> module cannot unpickle some value stored during the first run. Could you
> show the code you were using pythoscope on?
>
> ** Changed in: pythoscope
> Importance: Undecided => Medium
> Assignee: (unassigned) => Michal Kwiatkowski (ruby)
> Status: New => Incomplete
> Target: None => dynamic-analysis
>
> --
> pythoscope crashes if .pythoscope/project.pickle exists
> https://bugs.launchpad.net/bugs/271904
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Kent Tenney (ktenney) wrote :

The problem seems to be related to pythoscope scanning all
files under the location from where it is run. In my case,
there was lots of dodgy stuff lurking below.

If I place the test file in a different location, away from my other
projects, it works as expected.

On Thu, Sep 18, 2008 at 4:57 PM, Michal Kwiatkowski
<email address hidden> wrote:
> I need more information to reproduce this bug. It looks like the pickle
> module cannot unpickle some value stored during the first run. Could you
> show the code you were using pythoscope on?
>
> ** Changed in: pythoscope
> Importance: Undecided => Medium
> Assignee: (unassigned) => Michal Kwiatkowski (ruby)
> Status: New => Incomplete
> Target: None => dynamic-analysis
>
> --
> pythoscope crashes if .pythoscope/project.pickle exists
> https://bugs.launchpad.net/bugs/271904
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Changed in pythoscope:
milestone: dynamic-analysis → dynamic-analysis-fixes
Michal Kwiatkowski (ruby) wrote :

OK, I nailed the problem. It seems the pickle module has problems with lib2to3.pgen2.parse.ParseError:

>>> import pickle
>>> from lib2to3.pgen2.parse import ParseError
>>> pickle.loads(pickle.dumps(ParseError(1, 2, 3, 4)))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sw/all/Linux-x86_64/2.6/swhouse/python2_5.3.0/lib/python2.5/pickle.py", line 1374, in loads
    return Unpickler(file).load()
  File "/sw/all/Linux-x86_64/2.6/swhouse/python2_5.3.0/lib/python2.5/pickle.py", line 858, in load
    dispatch[key](self)
  File "/sw/all/Linux-x86_64/2.6/swhouse/python2_5.3.0/lib/python2.5/pickle.py", line 1133, in load_reduce
    value = func(*args)
TypeError: __init__() takes exactly 5 arguments (2 given)

This error manifests itself when one or more modules Pythoscope analyzes has syntax errors, thus making ParseError a part of the pickled object.

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

Fixed in revision 191.

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

Fix released in 0.3.1.

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

Bug attachments