Closed
Bug 568726
Opened 15 years ago
Closed 13 years ago
Rework exception handling for automation scripts
Categories
(Mozilla QA Graveyard :: Mozmill Automation, defect)
Mozilla QA Graveyard
Mozmill Automation
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: whimboo, Assigned: whimboo)
References
()
Details
Attachments
(2 files, 2 obsolete files)
(deleted),
patch
|
davehunt
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
automatedtester
:
review+
|
Details | Diff | Splinter Review |
We should rework the handling of exceptions in all of the automation scripts.
Assignee | ||
Updated•14 years ago
|
Component: Mozmill → Mozmill Tests
QA Contact: mozmill → mozmilltests
Summary: [mozmill] Rework exception handling for automation scripts → Rework exception handling for automation scripts
Assignee | ||
Comment 1•14 years ago
|
||
Move of Mozmill related project bugs to newly created components. You can
filter out those emails by using "Mozmill-Tests-to-MozillaQA" as criteria.
Component: Mozmill Tests → Mozmill Automation
Product: Testing → Mozilla QA
QA Contact: mozmill-tests → mozmill-automation
Whiteboard: [mozmill-automation]
Version: Trunk → unspecified
Assignee | ||
Updated•13 years ago
|
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•13 years ago
|
||
For the first step let us fix the BaseException deprecation messages, so we can see the real exception messages if something fails.
Attachment #562764 -
Flags: review?(dave.hunt)
Comment 3•13 years ago
|
||
Comment on attachment 562764 [details] [diff] [review]
Fix for BaseException deprecation messages
># HG changeset patch
># Parent 1f4177ac557bd4a95c8a4e87140c1240eaf4fe5b
># User Henrik Skupin <hskupin@mozilla.com>
>Bug 568726 - Fix BaseException deprecation messages. r=dhunt
>
>diff --git a/libs/install.py b/libs/install.py
>--- a/libs/install.py
>+++ b/libs/install.py
>@@ -123,17 +123,17 @@ class Installer(object):
> targetFolder = destination + os.path.basename(bundle)
>
> # If there is an existing installation remove it now
> self.uninstall(targetFolder)
> print "*** Copying %s to %s" % (bundle, targetFolder)
> shutil.copytree(bundle, targetFolder)
>
> destination = targetFolder
>- except Exception, e:
>+ except Exception:
> if not os.path.exists(targetFolder):
> print "*** Failure in copying the application files"
> raise e
Wouldn't this fail as 'e' is not defined?
Attachment #562764 -
Flags: review?(dave.hunt) → review-
Assignee | ||
Comment 4•13 years ago
|
||
Thanks for spotting this. Here the updated version.
Attachment #562764 -
Attachment is obsolete: true
Attachment #562912 -
Flags: review?(dave.hunt)
Comment 5•13 years ago
|
||
Comment on attachment 562912 [details] [diff] [review]
Patch v2
>- except IOError, e:
>+ except IOError as e:
> raise e
We can simplify this as just raise if we can to bubble it up
Comment 6•13 years ago
|
||
it might be worth raising another bug to change print statements to log calls then we can get error calls when something fails, e.g.
> print "*** Failure in copying the application files"
could be changed to
logger.critical('Failure in copying the application files')
just a thought
Assignee | ||
Comment 7•13 years ago
|
||
(In reply to David Burns :automatedtester from comment #5)
> Comment on attachment 562912 [details] [diff] [review] [diff] [details] [review]
> Patch v2
>
> >- except IOError, e:
> >+ except IOError as e:
> > raise e
>
>
> We can simplify this as just raise if we can to bubble it up
Can you be specific please? Can I simply drop the except block before the 'else'?
(In reply to David Burns :automatedtester from comment #6)
> it might be worth raising another bug to change print statements to log
> calls then we can get error calls when something fails, e.g.
>
> > print "*** Failure in copying the application files"
>
> could be changed to
>
> logger.critical('Failure in copying the application files')
>
> just a thought
Yeah. Sounds fine. Please do so.
Comment 8•13 years ago
|
||
Comment on attachment 562912 [details] [diff] [review]
Patch v2
I noticed in scraper.py that we've used the following:
try:
# Try to download the signed candidate build
MozillaScraper.download(self)
except NotFoundException as ex:
print str(ex)
Is it worth bringing this inline with the other try...except blocks, and change 'ex' to 'e'?
r+ me with or without that change, as it's a minor nit/question.
Attachment #562912 -
Flags: review?(dave.hunt) → review+
Comment 9•13 years ago
|
||
(In reply to Henrik Skupin (:whimboo) from comment #7)
> (In reply to David Burns :automatedtester from comment #5)
> > Comment on attachment 562912 [details] [diff] [review] [diff] [details] [review] [diff] [details] [review]
> > Patch v2
> >
> > >- except IOError, e:
> > >+ except IOError as e:
> > > raise e
> >
> >
> > We can simplify this as just raise if we can to bubble it up
>
What I was meaning was we can do
except IOError:
raise
The error variable e is not needed since we are just raising the exception up the stack.
Assignee | ||
Comment 10•13 years ago
|
||
Updated patch with all comments addressed. Please have a quick look over it.
Attachment #562912 -
Attachment is obsolete: true
Attachment #563165 -
Flags: review?(dave.hunt)
Updated•13 years ago
|
Attachment #563165 -
Flags: review?(dave.hunt) → review+
Assignee | ||
Comment 11•13 years ago
|
||
Comment on attachment 563165 [details] [diff] [review]
Fix for BaseException messages v3 [checked-in]
I will work on the remaining code next quarter.
Attachment #563165 -
Attachment description: Patch v3 → Fix for BaseException messages v3 [checked-in]
Assignee | ||
Comment 12•13 years ago
|
||
Assignee | ||
Comment 13•13 years ago
|
||
We can't make use of 'as' because it's not supported in Python 2.5. As long as we support platforms with Python 2.5 installed, we also have to support it in our scripts.
Attachment #568351 -
Flags: review?(dburns)
Comment 14•13 years ago
|
||
Comment on attachment 568351 [details] [diff] [review]
Don't use 'as' because it's not supported in Python 2.5 [checked-in]
Review of attachment 568351 [details] [diff] [review]:
-----------------------------------------------------------------
lgtm
Attachment #568351 -
Flags: review?(dburns) → review+
Assignee | ||
Comment 15•13 years ago
|
||
Comment on attachment 568351 [details] [diff] [review]
Don't use 'as' because it's not supported in Python 2.5 [checked-in]
Landed as:
http://hg.mozilla.org/qa/mozmill-automation/rev/68b25ecb16c6
Attachment #568351 -
Attachment description: Don't use 'as' because it's not supported in Python 2.5 → Don't use 'as' because it's not supported in Python 2.5 [checked-in]
Assignee | ||
Comment 16•13 years ago
|
||
I think that we are good enough here. Lets call it fixed and get a new bug opened if necessary.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•