Re: Query on Python Compiled source--Urgent

2013-10-14 Thread Tim Golden
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


Re: Query on Python Compiled source--Urgent

2013-10-14 Thread chandan kumar
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 m...@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-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Query on Python Compiled source--Urgent

2013-10-14 Thread chandan kumar


 
 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 m...@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
 
 
   
 -Inline Attachment Follows-
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list
 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Query on Python Compiled source--Urgent

2013-10-14 Thread Tim Golden
[Please post your answer below the previous reply, not above]

[... snip most of original traceback ...]

  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.

On 14/10/2013 10:34, chandan kumar wrote:
 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.NoTestCaseID   TestDescription TestResult 
  1 Test_case_1 SetTransmitPower   Pass
  2 Test_case_2 Set  Frequency   Fail
 
  
  Nothing is running parallel.

Sorry -- I didn't look closely enough at the error message. invalid
mode or filename wouldn't be the result of a file getting deleted out
from under a write.

Error 22 is returned from the MS runtime as EINVAL. It's not clear from
the traceback why it would consider that path invalid, but you're going
to have to do some legwork to narrow it down, I'm afraid.

The most likely prospects is that you're not running in the directory
you think you're in. Try putting a print os.getcwd() somewhere in the
mix to see where you actually are.

However, that still wouldn't quite explain why it occurs only sometimes
but, as I said, we'd have to know more about your test-runner to be able
to help.

TJG
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Query on Python Compiled source--Urgent

2013-10-14 Thread Alister
On Mon, 14 Oct 2013 13:41:35 +0800, chandan kumar wrote:
 
 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.

Logging to excel is probably a wrong thing to do (it is not a good idea 
to tie yourself into a 3rd party format that can be changed any time)

you would be better to log to a csv file which can then be opened by 
excell OR ANY OTHER spreadsheet application.

it is also far easier to use the CSV module than attempting to write a 
native XLS file


-- 
Mal: I've seen you without your clothes on before.  Never thought I'd see
you naked.
--Episode #11, Trash
-- 
https://mail.python.org/mailman/listinfo/python-list