Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-12-26 11:25:03 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-12-26 11:25:03 (GMT)
commitd23a83060ddad0b6da5504d8cb5d524891ad9631 (patch)
treebe881c67835922bc9d1c23276047b2f0241679c1 /tests
parentbc6035454c6138d0974173900e50e33793b2e5d0 (diff)
pep8ize
Diffstat (limited to 'tests')
-rw-r--r--tests/devbot/common.py1
-rw-r--r--tests/devbot/test_config.py33
-rw-r--r--tests/devbot/test_git.py13
-rw-r--r--tests/sugar/shell.py12
-rw-r--r--tests/sugar/tree.py3
5 files changed, 36 insertions, 26 deletions
diff --git a/tests/devbot/common.py b/tests/devbot/common.py
index ace8831..548bd3e 100644
--- a/tests/devbot/common.py
+++ b/tests/devbot/common.py
@@ -4,6 +4,7 @@ import tempfile
from devbot import config
+
class DevbotTestCase(unittest.TestCase):
def setUp(self):
self.setup_config()
diff --git a/tests/devbot/test_config.py b/tests/devbot/test_config.py
index 4309723..072c3a3 100644
--- a/tests/devbot/test_config.py
+++ b/tests/devbot/test_config.py
@@ -13,6 +13,7 @@ base_dir = os.path.dirname(os.path.dirname(tests_dir))
config_dir = os.path.join(base_dir, "config")
data_dir = os.path.join(tests_dir, "data")
+
class TestConfig(common.DevbotTestCase):
def setUp(self):
self.setup_config({"config_dir": config_dir})
@@ -22,15 +23,15 @@ class TestConfig(common.DevbotTestCase):
for info_class in distro._supported_distros:
if info_class.__module__.endswith("fedora"):
info_class._FEDORA_RELEASE_PATH = \
- os.path.join(data_dir, "fedora-release-%s" % version)
+ os.path.join(data_dir, "fedora-release-%s" % version)
if info_class.__module__.endswith("debian"):
info_class._DEBIAN_VERSION_PATH = \
- os.path.join(data_dir, "debian_version-wheezy")
+ os.path.join(data_dir, "debian_version-wheezy")
if info_class.__module__.endswith("ubuntu"):
info_class._OS_RELEASE_PATH = \
- os.path.join(data_dir, "os-release-ubuntu-12.10")
+ os.path.join(data_dir, "os-release-ubuntu-12.10")
def _get_architecture(self):
return "x86_64"
@@ -71,12 +72,12 @@ class TestConfig(common.DevbotTestCase):
self._set_distro("fedora", "17")
modules = config.load_modules()
- self._assert_module(modules, "gnome-keyring")
- self._assert_module(modules, "glib")
+ self._assert_module(modules, "gnome-keyring")
+ self._assert_module(modules, "glib")
self._assert_module(modules, "gtk+")
self._assert_module(modules, "gstreamer")
- self._assert_module(modules, "sugar")
-
+ self._assert_module(modules, "sugar")
+
self._unset_distro()
def test_fedora_18_modules(self):
@@ -85,11 +86,11 @@ class TestConfig(common.DevbotTestCase):
self.assertEquals("fedora", distro.get_distro_info().name)
self.assertEquals("18", distro.get_distro_info().version)
modules = config.load_modules()
- self._assert_module(modules, "glib")
+ self._assert_module(modules, "glib")
self._assert_no_module(modules, "gtk+")
- self._assert_no_module(modules, "gnome-keyring")
+ self._assert_no_module(modules, "gnome-keyring")
self._assert_no_module(modules, "gstreamer")
- self._assert_module(modules, "sugar")
+ self._assert_module(modules, "sugar")
self._unset_distro()
@@ -97,11 +98,11 @@ class TestConfig(common.DevbotTestCase):
self._set_distro("ubuntu", "12.10")
modules = config.load_modules()
- self._assert_module(modules, "glib")
+ self._assert_module(modules, "glib")
self._assert_no_module(modules, "gtk+")
- self._assert_no_module(modules, "gnome-keyring")
+ self._assert_no_module(modules, "gnome-keyring")
self._assert_no_module(modules, "gstreamer")
- self._assert_module(modules, "sugar")
+ self._assert_module(modules, "sugar")
self._unset_distro()
@@ -109,10 +110,10 @@ class TestConfig(common.DevbotTestCase):
self._set_distro("debian", "wheezy")
modules = config.load_modules()
- self._assert_module(modules, "gnome-keyring")
- self._assert_module(modules, "glib")
+ self._assert_module(modules, "gnome-keyring")
+ self._assert_module(modules, "glib")
self._assert_module(modules, "gtk+")
self._assert_module(modules, "gstreamer")
- self._assert_module(modules, "sugar")
+ self._assert_module(modules, "sugar")
self._unset_distro()
diff --git a/tests/devbot/test_git.py b/tests/devbot/test_git.py
index 48456bc..1e39650 100644
--- a/tests/devbot/test_git.py
+++ b/tests/devbot/test_git.py
@@ -5,6 +5,7 @@ import subprocess
from devbot import git
+
class TestGit(unittest.TestCase):
def _create_repo(self):
path = tempfile.mkdtemp()
@@ -53,7 +54,7 @@ class TestGit(unittest.TestCase):
def _create_module(self, remote, branch="master", tag=None):
path = tempfile.mkdtemp()
name = "test"
-
+
return git.Module(path=path, name=name, remote=remote, branch=branch,
tag=tag)
@@ -66,12 +67,12 @@ class TestGit(unittest.TestCase):
return module
def test_clone(self):
- module = self._setup_module()
+ module = self._setup_module()
self.assertTrue(os.path.exists(os.path.join(module.local, "README")))
def test_update_on_master(self):
- module = self._setup_module()
-
+ module = self._setup_module()
+
self._write_file(module.remote, "masterchange")
self._commit(module.remote, "masterchange")
@@ -94,7 +95,7 @@ class TestGit(unittest.TestCase):
def test_update_detached(self):
remote = self._create_repo()
-
+
module = self._create_module(remote, tag=self._get_head(remote))
module.update()
@@ -107,7 +108,7 @@ class TestGit(unittest.TestCase):
self.assertEquals("detachedchange", self._read_file(module))
def test_clean(self):
- module = self._setup_module()
+ module = self._setup_module()
module.update()
to_clean_path = os.path.join(module.local, "changetoclean")
diff --git a/tests/sugar/shell.py b/tests/sugar/shell.py
index 14a0709..ef2e4af 100644
--- a/tests/sugar/shell.py
+++ b/tests/sugar/shell.py
@@ -5,6 +5,7 @@ import tree
ACTIVITIES_WITH_OBJECT_CHOOSER = ["Read", "Jukebox"]
+
def build_activities_list():
root = tree.get_root()
shell = root.find_child(name="sugar-session", role_name="application")
@@ -14,7 +15,7 @@ def build_activities_list():
table = shell.find_child(role_name="table")
cells = table.find_children(role_name="table cell")
- for row in [cells[i:i+5] for i in range(0, len(cells), 5)]:
+ for row in [cells[i:i + 5] for i in range(0, len(cells), 5)]:
activity_name = row[2].text
activities.append(activity_name)
@@ -22,8 +23,9 @@ def build_activities_list():
return activities
+
def launch_and_stop_activity(activity_name):
- print "Launching %s" % activity_name
+ print "Launching %s" % activity_name
root = tree.get_root()
shell = root.find_child(name="sugar-session", role_name="application")
@@ -31,14 +33,14 @@ def launch_and_stop_activity(activity_name):
table = shell.find_child(role_name="table")
cells = table.find_children(role_name="table cell")
- for row in [cells[i:i+5] for i in range(0, len(cells), 5)]:
+ for row in [cells[i:i + 5] for i in range(0, len(cells), 5)]:
name = row[2].name
icon = row[1]
if name == activity_name:
icon.click()
- print "Stopping %s" % activity_name
+ print "Stopping %s" % activity_name
if activity_name in ACTIVITIES_WITH_OBJECT_CHOOSER:
close_button = shell.find_child(name="Close",
@@ -58,6 +60,7 @@ def launch_and_stop_activity(activity_name):
if activity is not None:
raise RuntimeError
+
def go_to_list_view():
root = tree.get_root()
shell = root.find_child(name="sugar-session", role_name="application")
@@ -68,6 +71,7 @@ def go_to_list_view():
radio_button = shell.find_child(name="List view", role_name="radio button")
radio_button.do_action("click")
+
def main():
go_to_list_view()
diff --git a/tests/sugar/tree.py b/tests/sugar/tree.py
index 88080c0..1438acc 100644
--- a/tests/sugar/tree.py
+++ b/tests/sugar/tree.py
@@ -4,9 +4,11 @@ from gi.repository import Atspi
Atspi.set_timeout(-1, -1)
+
def get_root():
return Node(Atspi.get_desktop(0))
+
def _retry_find(func):
def wrapped(*args, **kwargs):
result = None
@@ -33,6 +35,7 @@ def _retry_find(func):
return wrapped
+
class Node:
def __init__(self, accessible):
self._accessible = accessible