]> git.openstreetmap.org Git - osqa.git/blob - forum/management/commands/test_ui.py
54940660c5177d09441d6caddd8071a6c6cbc73c
[osqa.git] / forum / management / commands / test_ui.py
1 import os
2 import glob
3 import logging
4
5 from django.core.management.base import BaseCommand, CommandError
6 from django.conf import settings as django_settings
7
8 from forum import settings
9
10 class Command(BaseCommand):
11     args = '<test1 test2 test3 ...>'
12     help = 'Closes the specified poll for voting'
13
14     def handle(self, *args, **options):
15         # Try to load Selenium.
16         try:
17             import selenium
18             print "Selenium has been successfully loaded"
19         except ImportError:
20             logging.error("Couldn't load selenium")
21             exit("Python Selenium couldn't be loaded: pip install selenium")
22
23         # Tests folder
24         TEST_FOLDER = '%s/forum/skins/%s/tests' % (django_settings.SITE_SRC_ROOT, django_settings.OSQA_DEFAULT_SKIN)
25
26         # Check if the UI tests folder exists
27         if os.path.exists(TEST_FOLDER):
28             print 'Loading UI tests from %s' % TEST_FOLDER
29         else:
30             exit("UI tests folder couldn't be loaded")