← Back to team overview

sikuli-driver team mailing list archive

[Bug 620598] Re: X-1.0rc2: UnitTest: from __future__ fails in unit test script

 

** Description changed:

- reported with 10.2, fix committed for rc1, but still buggy with rc2
- --------------------------------------------------------------------
+ **** solution/workaround:
+ 
+ This was fixed in the sense that you don't need to import with_statement
+ anymore. It should be automatically imported.
+ 
+ from __future__ import ... does not work in current IDE Test environment
+ ------------------------------------------------------------------------
  
  When a test script is run (from the Run button in the Testing pane) that
  uses a "from __future__" import, it gives:
  
  Exception in thread "AWT-EventQueue-0" SyntaxError: ('from __future__
  imports must occur at the beginning of the file', ('<string>', 11, 1,
  ''))
  
  Sample script:
  
  from __future__ import with_statement
  
  def test_file_not_empty(self):
      with open('myfile.txt') as myfile:
          assert(len(myfile.read())) > 0
  
  32-bit Ubuntu 10.04, Sikuli 0.10.2

-- 
You received this bug notification because you are a member of Sikuli
Drivers, which is subscribed to Sikuli.
https://bugs.launchpad.net/bugs/620598

Title:
  X-1.0rc2: UnitTest: from __future__ fails in unit test script

Status in Sikuli:
  Fix Committed

Bug description:
  **** solution/workaround:

  This was fixed in the sense that you don't need to import
  with_statement anymore. It should be automatically imported.

  from __future__ import ... does not work in current IDE Test environment
  ------------------------------------------------------------------------

  When a test script is run (from the Run button in the Testing pane)
  that uses a "from __future__" import, it gives:

  Exception in thread "AWT-EventQueue-0" SyntaxError: ('from __future__
  imports must occur at the beginning of the file', ('<string>', 11, 1,
  ''))

  Sample script:

  from __future__ import with_statement

  def test_file_not_empty(self):
      with open('myfile.txt') as myfile:
          assert(len(myfile.read())) > 0

  32-bit Ubuntu 10.04, Sikuli 0.10.2

To manage notifications about this bug go to:
https://bugs.launchpad.net/sikuli/+bug/620598/+subscriptions