[Dev] Re: [commits] (dan) [9402] added platform specific test exclusion

Alec Flett alecf at osafoundation.org
Tue Feb 7 13:34:03 PST 2006


Hey Dan -
I think I have an alternate way to do platform exclusions that might be 
easier...

# make a dictionary:
exclusions = {
    "linux2": ("skiponlinux.py"),
    "darwin": ("skipondarwin.py", "anothertest.py")
}

# then just say:
tests_to_run = [test for test in allTests if test not in 
exclusions[sys.platform]]

because essentially what you're doing is mapping a string (sys.platform) 
to a list (exclude_on_linux/etc)

python also has a built-in function filter() which is almost identical 
to your exclude(). you could accomplish the same thing with it:

tests_to_run = filter(lambda x: x not in exclusions[sys.platform], allTests)


commits at osafoundation.org wrote:
>
> Revision
>     9402 <http://viewcvs.osafoundation.org/chandler?view=rev&rev=9402>
> Author
>     dan
> Date
>     2006-02-07 13:01:52 -0800 (Tue, 07 Feb 2006)
>
>
>       Log Message
>
> added platform specific test exclusion
>
>
>       Modified Paths
>
>     * trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py
>       <#trunkchandlertoolsQATestScriptsFunctionalFunctionalTestSuitepy>
>
>
>       Diff
>
>
>         Modified:
>         trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py
>         (9401 => 9402)
>
> --- trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py	2006-02-07 20:42:26 UTC (rev 9401)
> +++ trunk/chandler/tools/QATestScripts/Functional/FunctionalTestSuite.py	2006-02-07 21:01:52 UTC (rev 9402)
> @@ -3,7 +3,7 @@
>  ## Description: This test suite runs the 4 basic testcases of generating event, mail, task and note items in chandler
>   
>  import tools.QAUITestAppLib as QAUITestAppLib
> -import os
> +import os, sys
>  
>  functional_dir = os.path.join(os.getenv('CHANDLERHOME'),"tools/QATestScripts/Functional")
>  
> @@ -11,33 +11,60 @@
>  fileName = "FunctionalTestSuite.log"
>  logger = QAUITestAppLib.QALogger(fileName,"FunctionalTestSuite")
>  
> -def run_tests(*tests):
> +def exclude(fullList, excludeList):
> +    for item in excludeList:
> +        if item in fullList:
> +            fullList.remove(item)
> +    return fullList
> +
> +def run_tests(tests):
>      for filename in tests:
>          execfile(os.path.join(functional_dir, filename))
> +        
> +allTests = ["TestCreateAccounts.py",
> +                        "TestAllDayEvent.py", 
> +                        "TestNewCollection.py",
> +                        "TestDates.py", 
> +                        "TestNewEvent.py",
> +                        "TestNewMail.py",
> +                        "TestNewTask.py",
> +                        "TestNewNote.py",
> +                        "TestStamping.py", 
> +                        "TestMoveToTrash.py", 
> +                        "TestDeleteCollection.py",
> +                        "TestNewCollNoteStampMulti.py", 
> +                        "TestCalView.py",
> +                        "TestRecurrenceImporting.py", 
> +                        "TestRecurringEvent.py",  
> +                        "TestSwitchingViews.py",
> +                        "TestExporting.py",
> +                        "TestFlickr.py",
> +                        "TestImporting.py",
> +                        "TestImportOverwrite.py",
> +                        "TestSharing.py"]
>  
> +exclude_on_linux = [                                          
> +                                        ]
> +exclude_on_mac = [ 
> +                                        ]
> +exclude_on_windows = [ 
> +                                        ]
> +exclude_on_all = [
> +                                        "TestMoveToTrash.py", #bug # 5150  
> +                                        "TestStamping.py", #Chandler bug#5097
> +                                        "TestNewCollNoteStampMulti.py", #Chandler bug #5097
> +                                        "TestAllDayEvent.py", #test not functioning bug#5110
> +                                        "TestDates.py", #Chandler not handling daylightsavings bug#5038
> +                                        "TestRecurrenceImporting.py", #Chandler bug #5116
> +                                    ]
> +
> +tests_to_run = exclude(allTests, exclude_on_all)
> +if sys.platform == "linux2" : tests_to_run = exclude(tests_to_run, exclude_on_linux)
> +if sys.platform == "darwin" : tests_to_run = exclude(tests_to_run, exclude_on_mac)
> +if sys.platform == "win32" : tests_to_run = exclude(tests_to_run, exclude_on_windows)
> +
>  try:
> -    run_tests("TestCreateAccounts.py",
> -              #"TestAllDayEvent.py", test not functioning bug#5110
> -              "TestNewCollection.py",
> -              #"TestDates.py", Chandler not handling daylightsavings bug#5038
> -              "TestNewEvent.py",
> -              "TestNewMail.py",
> -              "TestNewTask.py",
> -              "TestNewNote.py",
> -              #"TestStamping.py", Chandler bug#5097
> -              #"TestMoveToTrash.py", bug # 5150
> -              "TestDeleteCollection.py",
> -              #"TestNewCollNoteStampMulti.py", Chandler bug #5097
> -              "TestCalView.py",
> -              #"TestRecurrenceImporting.py", Chandler bug #5116
> -              "TestRecurringEvent.py",  
> -              "TestSwitchingViews.py",
> -              "TestExporting.py",
> -              "TestFlickr.py",
> -              "TestImporting.py",
> -              "TestImportOverwrite.py",
> -              "TestSharing.py")
> -    
> +    run_tests(tests_to_run)
>  finally:    
>      #cleaning
>      logger.Close()
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Commits mailing list
> Commits at osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/commits
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osafoundation.org/pipermail/dev/attachments/20060207/bf361e1f/attachment.html


More information about the Dev mailing list