Skip to content

Using Eclipse with autotest

ldoktor edited this page May 29, 2012 · 4 revisions

How to develop Autotest in Eclipse

Instalation

  1. Download latest Eclipse (doesn't matter which version, there is no existing stock version with python) http://download.eclipse.org/eclipse/downloads/

  2. Use any folder as default workspace path (it's basically a name, you can have sources anywhere else)

  3. Select Help->Install new software and Add new source and install current version of PyDev for Eclipse

Name: pydev
Location: http://pydev.org/updates
  1. Select Help->Install new software and Add new source and install current version of Eclipse EGit
Name: egit
Location: http://download.eclipse.org/egit/updates
  1. After Eclipse restart right-click in Navigator window and select Import..., Git->Projects from Git, add Autotest base directory and on next window check Import as general project.

  2. From now one, you can start developing Autotest. Anyway I'd recommend you to go through next section first ;-)

Eclipse setup

Imports

  1. First autotest is importing libraries in different namespace. I've found a way to get over this using symlink.
mkdir -p $somedir/autotest
touch $somedir/__init__.py
touch $somedir/autotest/__init__.py
ln -s $autotest_root/client $somedir/autotest/client
  1. than you add this directory to python path in right-click on project->properties->PyDev - PYTHONPATH->External Libraries click Add source folder and find the $somedir directory.

  2. From now one you'll see docstrings and all the other usual features of Eclipse.

Pep8

Eclipse can automatically check quality of your code using pep8.py. In newer versions you can find it in Window->Preferences->PyDev->Editor->Code Analysis->pep8.py. By default it's turned off so just change the value to Warning and you'll see little exclamation mark by the unmatching lines.

Other setting

I'd recommend you to turn on line numbers (Window->Preferences->General->Editors->Text Editors->Show line numbers

Using Eclipse

There are some basic stuff that made me switch from VIM.

  • hoover over anything and you'll get docstring/definition/... of the context
  • ctrl+left-click and it'll transfer you to the definition
  • when you place cursor somewhere, it highlights other occurrences of the current value/function
  • window->new editor opens the current source in another view. You will have 2 cursors, 2 highlights, 2 parts of current file
  • window->new window opens new window :-)
  • Right-click->refactor... does a lot of nice things (not that powerful as with Java thought, but still a great tool with preview)
  • drag and drop layouts (split view, hide consoles ... just click and move everything everywhere)
  • DEBUGING (see the next chapter)

I'm not using Eclipse for Autotest execution (although it can do that too) as I prefer xterm outputs...

Debuging with Eclipse

TODO

Clone this wiki locally