0

I have a Django project for which I am incorporating BDD using behave. I am using PyDev as my development environment. I have installed behave_dhango and behave using pip within the conda environment and I can see that the folders have been created in the site-packages folder within the right conda 'env'.

For some reason, I am not able to import the 'given, when and then' decorators from behave as thus:

    from behave import given, when, then

It says "Unresolved import given... when... and then..."

I have not found any naming conflicts and cannot understand the reason why the above code isn't working.

Python 2.7 Django 1.11 behave 1.2.6

  • Did you add `behave_django` into *settings.INSTALLED_APPS* – Waket Zheng Jun 15 '18 at 01:53
  • Thanks, Waket. Yes... It is set in the INSTALLED_APPS... But not having it set shouldn't stop me from importing within another, should it? – Rajiv Shankar Jun 15 '18 at 09:18
  • If you add `behave` to the forced builtins, does it work? (see http://www.pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-ForcedBuiltins for details on how to do that). – Fabio Zadrozny Jun 16 '18 at 17:08
  • @Fabio, adding 'behave' to the forced builtins worked like a charm... Thanks for your help... – Rajiv Shankar Jun 17 '18 at 21:20

2 Answers2

0

Have you set the interpreter of PyDev?

http://www.pydev.org/manual_101_interpreter.html

Waket Zheng
  • 5,065
  • 2
  • 17
  • 30
0

If you add behave to the forced builtins, does it work? (see pydev.org/… for details on how to do that). – Thanks to Fabio Zadrozny