2014-01-16 47 views
0

我正在使用FreshenExceptionWrapper錯誤梳洗

C:\Front_End>nosetests --with-f 
    reshen -v features\ 
    Addition: Add two numbers ... ok 
    Addition: Add two numbers ... ok 
    Addition: Add two numbers ... ok 
    Division: Regular numbers ... ok 
    User: Retrieve a user using ID ... ERROR 

    ====================================================================== 
    ERROR: User: Retrieve a user using ID 
    ---------------------------------------------------------------------- 
    ExceptionWrapper 

    ---------------------------------------------------------------------- 
    Ran 5 tests in 0.230s 

    FAILED (errors=1) 

這裏是我的文件,這個模糊的錯誤:

user.feature:

Feature: user 
    In order for things to work 
    We need to be able to retrieve users 
    From the Database 

    Scenario Outline: Retrieve a user using ID 
    Given I have the account number <account_number> 
    And I have the user id <user_id> 
    Then the users <field_name> should be <field_value> 

    Examples: 
    | account_number | user_id | field_name | field_value | 
    | 57    | 28967 |username | user101 | 

steps.py

from freshen import * 
from freshen.checks import * 

import user_operations 


appid = "12345" 
secret = "54321" 
api_root = "http://api.stuff.com/" 

@Before 
def before(sc): 
    scc.headers = {'Content-Type':'application/json','Accept':'application/json'} 
    token, scope = user_operations.get_auth_token_and_scope(api_root, appid, secret, scc.headers)#Needs test in itself 
    scc.headers['Authorization'] = 'Pbnb ' + token 
    scc.result = None 

@Given("I have the account number (\d+)") 
def set_account_num(account_number): 
    scc.account_number = int(account_number) 

@Given("I have the user id (\d+)") 
def set_user_id(user_id): 
    scc.user_id = int(user_id) 

@Then("the users (.*) should be (.*)") 
def check_result(field_name, field_value): 
    user = user_operations.get_user(scc.account_number, scc.user_id, "id", scc.headers) 
    assert_equal(str(field_value), user[str(field_name)]) 

如果任何人有任何想法,我會很感激任何意見!

回答

0

可能是早期,但我想我找到了答案here

I can work-around this with the patch below. 

--- noseplugin.py.orig 2011-07-22 18:34:11.000000000 +0200 
+++ noseplugin.py 2011-07-22 18:34:31.000000000 +0200 
@@ -70,8 +70,6 @@ 
       self.step_runner.run_step(step) 
      except (AssertionError, UndefinedStepImpl, ExceptionWrapper): 
       raise 
-   except: 
-    raise ExceptionWrapper(sys.exc_info(), step) 

      for hook_impl in reversed(self.step_registry.get_hooks('after_step', self.scenario.get_tags())): 
       hook_impl.run(self.scenario) 

cheers, 
serafeim