Step files being ignored after terrain.py loads
Karunamon opened this issue · 2 comments
Greetings all.
I'm trying to write a test suite for some custom JIRA code, and try as I might, my steps.py
file is getting ignored. That is, terrain.py
is loaded, the feature file is loaded, but the output from lettuce implies that the steps file doesn't exist.
The directory structure looks like this:
systemtest/
features/
1_fieldvalidation.feature
terrain.py
steps.py
Terrain.py sets some world variables:
from lettuce import world
from jira import JIRA
from time import ctime, time
admin_login = 'admin'
admin_password = 'password'
start_time = ctime()
end_time = ctime(time() + 1200)
# "World" items are considered global variables accessible by all steps.
world.jira = JIRA('https://jira.local', basic_auth=(admin_login, admin_password))
The feature itself:
Feature: Field validation
In order to keep my managers happy
As a user
I want to ensure I enter valid information on my tickets
Scenario Outline: Incomplete ticket
Given I have entered a ticket with the <field> field missing
Then I should not be allowed to submit the ticket.
Examples:
| field |
| Summary |
| Description |
And the step file:
from lettuce import *
import bpython
# -*- coding: utf-8 -*-
@step(u'Given I have entered a ticket with the <field> field missing')
def given_i_have_entered_a_ticket_with_the_field_field_missing(step):
j = world.jira
# Construct the issue dictionary, then we take the "field" and delete it.
# Submission should fail.
step.asdfgh() #THIS FUNCTION DOESN'T EXIST AND SHOULD CAUSE AN ERROR
bpython.embed()
assert True, 'This step must be implemented'
Given that I don't get an exception or a bpython shell, and the output from lettuce still shows the "You can implement step definitions..." stubs, I can conclude that the steps file isn't being evaluated.
I'm running lettuce
from the top level tests/
directory. This is Python 2.7.10 on OSX.
I dropped a PDB breakpoint inside of my terrain.py
to step through what was happening here, but this isn't much more help.
A loop is entered that picks up both files:
/Users/mparks/.virtualenvs/env/lib/python2.7/site-packages/lettuce/fs.py(51)find_and_load_step_definitions()
-> for filename in files:
(Pdb) whatis files
<type 'list'>
(Pdb) files
['/Users/mparks/Dropbox/Projects/test/features/steps.py', '/Users/mparks/Dropbox/Projects/test/features/terrain.py']
Next, the terrain file gets parsed:
> /Users/mparks/.virtualenvs/env/lib/python2.7/site-packages/lettuce/fs.py(51)find_and_load_step_definitions()->None
-> for filename in files:
(Pdb) filename
'/Users/mparks/Dropbox/Projects/test/features/terrain.py'
At no point does the original 'files' list ever get re-entered. It's like something in terrain.py is breaking out of the loop.