Query on Python Compiled source--Urgent

chandan kumar chandan_psr at yahoo.co.in
Mon Oct 14 05:03:18 EDT 2013


Hi,
Yes ,its not actual logging module.Using pyexcelerator we are storing just test results to excel file.
Each test suite has some 25-100 test cases.We are using unit test from python ,after completion of each test case the test result will be stored in excel file.Below is the sample result that is stored in excel file.

S.No   TestCaseID   TestDescription    TestResult 
1         Test_case_1 SetTransmitPower  Pass
2         Test_case_2 Set  Frequency        fail


Nothing is running parallel.

Best Regards,
Chandan



On Monday, 14 October 2013 1:10 PM, Tim Golden <mail at timgolden.me.uk> wrote:
 
On 14/10/2013 06:41, chandan kumar wrote:

> I'm working on a python project for protocol testing.I need to provide
> only python compiled source to our customer.
> 
> Here are the steps followed to take python compiled from actual source.
> 1.There are 5 different test suites under the project
> 2..Run all 5  test suite with python sources.
> 3.After completion of test suite ,just take .pyc files and copied in to
> seperate folder.
> 4.Re run test suite for any issues with the .pyc code.I started seeing
> one issue when it logs the test results in to excel file.
>  This issue occurs sometimes.50% of chances are there to see this issue
> 
> Below is the error
> Traceback (most recent call last):
>   File "D:\users\ScriptTestCode\scriptsCompiledCode\ExecuteScripts.py",
> line 32, in <module>
>     TestManager.execute_scripts(TEST_BUILD)
>   File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py",
> line 764, in execute_scripts
>   File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py",
> line 772, in _execute_all
>   File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py",
> line 924, in _testsuite_950_band
>   File "D:\users\ScriptTestCode\scriptsCompiledCode\TestManager.py",
> line 377, in exec_test_suite
>   File "D:\users\ScriptTestCode\scripts\ResultReporter.py", line 321, in
> save_test_results
>     _my_doc.save(StackTestData.TEST_REPORT_PATH)
>   File "C:\Python27\lib\site-packages\pyExcelerator\Workbook.py", line
> 610, in save
>     doc.save(filename, self.get_biff_data())
>   File "C:\Python27\lib\site-packages\pyExcelerator\CompoundDoc.py",
> line 554, in save
>     f = file(filename, 'wb')
> IOError: [Errno 22] invalid mode ('wb') or filename:
> '.\\TestResults\\TestReport.xls'
> 
> Now my question is of there any issue with logging to excel it should
> happen for the first test suite itself,but it occurs in either 2,3,4 or
> 5 test suite. Some it runs without any issues.

Well, the fact that it works/fails 50% of the time points to a race
condition. You don't say how the test suites / tests are running, but if
anything's running in parallel, one test's cleanup could be pulling the
file out from under another test's writing results. Without knowing more
about your test runner, this is really guess-work.

Logging to Excel isn't part of the builtin logging module so you've
presumably added that functionality yourself. But PyExcelerator is
ultimately just opening a file and writing to it so for this purpose it
appears to be equivalent to, say, logging a bunch of stuff into a list
and then writing that into a file.

TJG
-- 
https://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20131014/45ca8c82/attachment.html>


More information about the Python-list mailing list