aboutsummaryrefslogtreecommitdiffstats
path: root/tests/environment.py
diff options
context:
space:
mode:
authorVadim Rutkovsky <vrutkovs@redhat.com>2014-03-21 23:15:00 +0800
committerVadim Rutkovsky <vrutkovs@redhat.com>2014-03-25 16:46:23 +0800
commit399b1a6fc593a9c5e692923120346e0386f578e5 (patch)
tree0ce0730706208dfb3f34cd2c4b7335aa3872491f /tests/environment.py
parenta9b96e5ae15d13d204e7bef5da283bb34154d9c8 (diff)
downloadgsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.tar
gsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.tar.gz
gsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.tar.bz2
gsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.tar.lz
gsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.tar.xz
gsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.tar.zst
gsoc2013-evolution-399b1a6fc593a9c5e692923120346e0386f578e5.zip
Add installed tests using --enable-installed-tests switch
https://bugzilla.gnome.org/show_bug.cgi?id=726832
Diffstat (limited to 'tests/environment.py')
-rw-r--r--tests/environment.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/environment.py b/tests/environment.py
new file mode 100644
index 0000000000..2d6a09f479
--- /dev/null
+++ b/tests/environment.py
@@ -0,0 +1,46 @@
+# -*- coding: UTF-8 -*-
+
+from time import sleep
+from dogtail.utils import isA11yEnabled, enableA11y
+if not isA11yEnabled():
+ enableA11y(True)
+
+from common_steps import App, dummy, cleanup
+from dogtail.config import config
+
+
+def before_all(context):
+ """Setup evolution stuff
+ Being executed once before any test
+ """
+
+ try:
+ # Skip dogtail actions to print to stdout
+ config.logDebugToStdOut = False
+ config.typingDelay = 0.2
+
+ # Include assertion object
+ context.assertion = dummy()
+
+ # Cleanup existing data before any test
+ cleanup()
+
+ context.app_class = App('evolution')
+
+ except Exception as e:
+ print("Error in before_all: %s" % e.message)
+
+
+def after_scenario(context, scenario):
+ """Teardown for each scenario
+ Kill evolution (in order to make this reliable we send sigkill)
+ """
+ try:
+ # Stop evolution
+ context.app_class.kill()
+
+ # Make some pause after scenario
+ sleep(1)
+ except Exception as e:
+ # Stupid behave simply crashes in case exception has occurred
+ print("Error in after_scenario: %s" % e.message)