How can I use lettuce in my Django project, within Eclipse?

276 views Asked by At

I'm following the Django Tutorial for Django v1.6, and running it inside eclipse with PyDev. I got to the page on testing and I thought I'd mix it up (read: Run before I can walk) and learn Lettuce as well.

From what I've read online lettuce should be bundled with PyDev by default. which makes sense as the line from lettuce import * does not error in my steps.py, but the rest of the code does:

from lettuce import *

@step('Given my poll is (\d+) days in the future')
def have_future_poll(step, number):
    world.number = int(number)

The error for the @step is:

Undefined variable: step step Found at: polls.tests.features.steps

step

And for world is:

Undefined variable: world

So I don't think it's importing properly.

How should I use Lettuce in eclipse?

1

There are 1 answers

1
Tobi On

To use lattuce.world try to import world explicit: from lattuce import world should work then - I experienced that phenomenon with other apps like logicaldelete, too. But I can't tell why it does not work the way you did...

To use @step you should import that function/file/app step(..) as well: from polls.tests.features import steps. Otherwise there is no methode named step(..) defined within your .py-file and @step becomes a decorator of a non-existing method.