problem with imports running junit test

Asked by Leo Arias on 2012-07-22

Hello there,

I'm using sikuli on Ubuntu Precise, and I am trying to use modules for common actions and stuff like that.

I have this:

import os.path

ubuntu_actions_path = os.path.join('shared', 'actions', 'ubuntu')
control_panel_actions_path = os.path.join('shared', 'actions', 'controlpanel')
actions_paths = [ubuntu_actions_path, control_panel_actions_path]
for actions_path in actions_paths:
    if not actions_path in sys.path:
        sys.path.append(actions_path)

import unity
import devices

unity.open_ubuntuone_from_launcher_icon()
devices.open_tab()
devices.remove_this_device()

And works flawlessly. (Thanks, btw)

But now I want the script to be a unit test. So I change it to be:

def test_remove_this_device(self):
    unity.open_ubuntuone_from_launcher_icon()
    devices.open_tab()
    devices.remove_this_device()

and I get:
NameError: global name 'unity' is not defined

Am I missing something? Am I doing something stupid?

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2012-07-22
Last reply:
2012-07-22
RaiMan (raimund-hocke) said : #1

You are using the UnitTest feature in the IDE, right?

Just forget it: faq 1804

Can you help with this problem?

Provide an answer of your own, or ask Leo Arias for more information if necessary.

To post a message you must log in.