Question

I am getting this vague error using Freshen

   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)

Here are my files:

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)])

If anybody has any idea I'd appreciate any comments!

Was it helpful?

Solution

Might be early days, but I think I found the answer 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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top