wrong indent after adding entrypoint tests

Bug #271892 reported by joep
4
Affects Status Importance Assigned to Milestone
Pythoscope
Fix Released
Medium
Michal Kwiatkowski

Bug Description

working through the tutorial/documentation on WindowsXP:

first I generated tests without entrypoints, works fine
second I add entrypoints and generate tests again
result: tests are appended as described in tutorial but first
``def`` line of test method is missing the intendation

after manually intending it, generated test are as described an work
correctly.

example:

class TestOldPython(unittest.TestCase):
    def test_hiss(self):
        assert False # TODO: implement your test here

    def test_object_initialization(self):
        assert False # TODO: implement your test here

def test_creation_with_45_raises_value_error(self): # this line is not intended
        self.assertRaises(ValueError, lambda: OldPython(age=45))

    def test_hiss_returns_60_to_70_after_creation_with_65(self):
        old_python = OldPython(age=65)

PS: comment on tutorial
since I'm running the tests from outside the project, I had to add the package name to the
import in the entry points, e.g.
from testproj.old_nest import OldNest
otherwise I get import errors when runnng tests.

Related branches

Revision history for this message
Michal Kwiatkowski (ruby) wrote :

I stumbled unto this bug once or twice, but after further inspection I couldn't reproduce it. It seemed to appear only when appending to new test classes generated by the Pythoscope itself. Those are kept pickled the way they were generated. If you force reparsing of the test file (e.g. by touching it) Pythoscope will be able to append new test cases just right. The bug is most likely inside the store.py:TestClass._append_test_case_code method.

Changed in pythoscope:
assignee: nobody → ruby
importance: Undecided → Medium
milestone: none → dynamic-analysis
status: New → Confirmed
Revision history for this message
Michal Kwiatkowski (ruby) wrote :

And about your tutorial comment: all points of entry imports should be relative to the directory you executed --init in. You're right, I should make that clearer in the tutorial, thanks!

Changed in pythoscope:
milestone: dynamic-analysis → dynamic-analysis-fixes
Revision history for this message
Michal Kwiatkowski (ruby) wrote :

Fixed in revision 195.

Changed in pythoscope:
status: Confirmed → Fix Committed
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.