Notice: In order to edit this ticket you need to be either: a Product Owner, The owner or the reporter of the ticket, or, in case of a Task not yet assigned, a team_member"

Task #2833 (closed)

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

Add Python 2.4 tests

Reported by: jamoore Owned by: jamoore
Priority: critical Milestone: OMERO-Beta4.2.1
Component: Deployment Version: n.a.
Keywords: n.a. Cc: cxallan, dzmacdonald, jburel, wmoore
Resources: n.a. Referenced By: n.a.
References: n.a. Remaining Time: 0.0d
Sprint: 2010-10-28 (18)

Description

Several Python 2.5+ syntax features crept in 4.2.0. All python tests should also be run against 2.4 as long as we support it.

See: https://www.openmicroscopy.org/community/viewtopic.php?f=5&t=465&start=0

Change History (14)

comment:1 Changed 9 years ago by cxallan

  • Owner changed from ome-nitpick@… to cxallan

comment:2 Changed 9 years ago by atarkowska

  • Sprint set to 2010-09-09 (16)

comment:3 Changed 9 years ago by cxallan

  • Remaining Time set to 0.5

comment:4 Changed 9 years ago by jburel

  • Sprint changed from 2010-09-09 (16) to 2010-09-30 (17)

comment:5 Changed 9 years ago by jmoore

  • Owner changed from cxallan to jmoore

comment:6 Changed 9 years ago by jburel

  • Sprint changed from 2010-09-30 (17) to 2010-10-28 (18)

Moved from sprint 2010-09-30 (17)

comment:7 Changed 9 years ago by jmoore

Created OMERO-trunk-python2.4-integration job on hudson. Uses the virtualenv $HOME/env2.4/ on the hudson master to run tests. Many tests may fail initially due to missing IcePy for 2.4 which we'll have to compile ourselves.

comment:8 Changed 9 years ago by jmoore

(In [8338]) Fixing non-Python2.4 scripts syntax (See #2833)

comment:9 Changed 9 years ago by wmoore

Josh: Is there a way to achieve the same functionality

except: raise

in Python 2.4 syntax?

The reason I put the 'raise' in was because I found that if you don't then any exception you get from running the script doesn't get reported back to you. The script fails 'silently' and you have no idea what went wrong. The stack trace is useful both for developing and when others are using the script and reporting bugs.

comment:10 Changed 9 years ago by jmoore

Will,

I think something else must have been going on in the scripts.

try:
    1/0
except:
    raise
finally:
    pass

is identical to:

try:
    1/0
finally:
    pass

since if there is no except clause the exception will automatically be raised. If you can reproduce what you were seeing, it might point to some other issue which we need to address, but in general, you don't need "except: raise" or anything similar.

Here's a full example, if it might help you find out what was going on:

import unittest

class Test(unittest.TestCase):

    def withoutExcept(self):
        try:
            1/0
        finally:
            pass

    def withExcept(self):
        try:
            1/0
        except: raise # must be commented out for Python2.4
        finally:
            pass

    def testExceptions(self):
        self.assertRaises(ZeroDivisionError, self.withoutExcept)
        self.assertRaises(ZeroDivisionError, self.withExcept)

if __name__ == "__main__":
    unittest.main()

comment:11 Changed 9 years ago by jmoore

(In [8353]) Fixing more non-Python2.4 scripts syntax (See #2833)

comment:12 Changed 9 years ago by jmoore

(In [8377]) Fixing integration/library.py (See #2833)

comment:13 Changed 9 years ago by jmoore

  • Remaining Time changed from 0.5 to 0
  • Resolution set to fixed
  • Status changed from new to closed

Though the job is not passing, the only thing failing is the use of PyTables due to a bad installation, as far as I can tell. Closing this ticket, and as a general part of #1736 (hudson green) we'll improve that.

comment:14 Changed 9 years ago by jmoore

(In [8392]) Fix for library.py's index method (See #2833)

Note: See TracTickets for help on using tickets. You may also have a look at Agilo extensions to the ticket.

1.3.13-PRO © 2008-2011 Agilo Software all rights reserved (this page was served in: 0.83105 sec.)

We're Hiring!