##// END OF EJS Templates
test env update
marcink -
r1416:df04752d beta
parent child Browse files
Show More
@@ -24,7 +24,6 b''
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 import os
25 import os
26 import sys
26 import sys
27 import getpass
28
27
29 from mercurial.scmutil import revrange
28 from mercurial.scmutil import revrange
30 from mercurial.node import nullrev
29 from mercurial.node import nullrev
@@ -494,27 +494,9 b' def create_test_env(repos_test_path, con'
494 HG_FORK, GIT_FORK, TESTS_TMP_PATH
494 HG_FORK, GIT_FORK, TESTS_TMP_PATH
495 import tarfile
495 import tarfile
496 import shutil
496 import shutil
497 from os.path import dirname as dn, join as jn, abspath
497 from os.path import abspath
498
499 log = logging.getLogger('TestEnvCreator')
500 # create logger
501 log.setLevel(logging.DEBUG)
502 log.propagate = True
503 # create console handler and set level to debug
504 ch = logging.StreamHandler()
505 ch.setLevel(logging.DEBUG)
506
498
507 # create formatter
499 # PART ONE create db
508 formatter = logging.Formatter("%(asctime)s - %(name)s -"
509 " %(levelname)s - %(message)s")
510
511 # add formatter to ch
512 ch.setFormatter(formatter)
513
514 # add ch to logger
515 log.addHandler(ch)
516
517 #PART ONE create db
518 dbconf = config['sqlalchemy.db1.url']
500 dbconf = config['sqlalchemy.db1.url']
519 log.debug('making test db %s', dbconf)
501 log.debug('making test db %s', dbconf)
520
502
@@ -532,16 +514,9 b' def create_test_env(repos_test_path, con'
532 dbmanage.create_permissions()
514 dbmanage.create_permissions()
533 dbmanage.populate_default_permissions()
515 dbmanage.populate_default_permissions()
534
516
535 #PART TWO make test repo
517 # PART TWO make test repo
536 log.debug('making test vcs repositories')
518 log.debug('making test vcs repositories')
537
519
538 #remove old one from previos tests
539 for r in [HG_REPO, GIT_REPO, NEW_HG_REPO, NEW_GIT_REPO, HG_FORK, GIT_FORK]:
540
541 if os.path.isdir(jn(TESTS_TMP_PATH, r)):
542 log.debug('removing %s', r)
543 shutil.rmtree(jn(TESTS_TMP_PATH, r))
544
545 idx_path = config['app_conf']['index_dir']
520 idx_path = config['app_conf']['index_dir']
546 data_path = config['app_conf']['cache_dir']
521 data_path = config['app_conf']['cache_dir']
547
522
@@ -27,19 +27,22 b' log = logging.getLogger(__name__)'
27 import pylons.test
27 import pylons.test
28
28
29 __all__ = ['environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO',
29 __all__ = ['environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO',
30 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', ]
30 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK',
31 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_ADMIN_PASS' ]
31
32
32 # Invoke websetup with the current config file
33 # Invoke websetup with the current config file
33 #SetupCommand('setup-app').run([config_file])
34 #SetupCommand('setup-app').run([config_file])
34
35
35 ##RUNNING DESIRED TESTS
36 ##RUNNING DESIRED TESTS
36 #nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
37 # nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
37
38 # nosetests --pdb --pdb-failures
38 environ = {}
39 environ = {}
39
40
40 #SOME GLOBALS FOR TESTS
41 #SOME GLOBALS FOR TESTS
41 from tempfile import _RandomNameSequence
42 from tempfile import _RandomNameSequence
42 TESTS_TMP_PATH = jn('/', 'tmp', 'rc_test_%s' % _RandomNameSequence().next())
43 TESTS_TMP_PATH = jn('/', 'tmp', 'rc_test_%s' % _RandomNameSequence().next())
44 TEST_USER_ADMIN_LOGIN = 'test_admin'
45 TEST_USER_ADMIN_PASS = 'test12'
43 HG_REPO = 'vcs_test_hg'
46 HG_REPO = 'vcs_test_hg'
44 GIT_REPO = 'vcs_test_git'
47 GIT_REPO = 'vcs_test_git'
45
48
@@ -61,7 +64,8 b' class TestController(TestCase):'
61 self.index_location = config['app_conf']['index_dir']
64 self.index_location = config['app_conf']['index_dir']
62 TestCase.__init__(self, *args, **kwargs)
65 TestCase.__init__(self, *args, **kwargs)
63
66
64 def log_user(self, username='test_admin', password='test12'):
67 def log_user(self, username=TEST_USER_ADMIN_LOGIN,
68 password=TEST_USER_ADMIN_PASS):
65 response = self.app.post(url(controller='login', action='index'),
69 response = self.app.post(url(controller='login', action='index'),
66 {'username':username,
70 {'username':username,
67 'password':password})
71 'password':password})
@@ -4,7 +4,7 b''
4 ~~~~~~~~~~~~~~~~~~~~~~~~~
4 ~~~~~~~~~~~~~~~~~~~~~~~~~
5
5
6
6
7 Package for testing varios lib/helper functions in rhodecode
7 Package for testing various lib/helper functions in rhodecode
8
8
9 :created_on: Jun 9, 2011
9 :created_on: Jun 9, 2011
10 :copyright: (c) 2011 by marcink.
10 :copyright: (c) 2011 by marcink.
@@ -16,7 +16,6 b''
16 import unittest
16 import unittest
17 from rhodecode.tests import *
17 from rhodecode.tests import *
18
18
19
20 proto = 'http'
19 proto = 'http'
21 TEST_URLS = [
20 TEST_URLS = [
22 ('%s://127.0.0.1' % proto, ['%s://' % proto, '127.0.0.1'],
21 ('%s://127.0.0.1' % proto, ['%s://' % proto, '127.0.0.1'],
@@ -6,10 +6,11 b' tag_svn_revision = true'
6 find_links = http://www.pylonshq.com/download/
6 find_links = http://www.pylonshq.com/download/
7
7
8 [nosetests]
8 [nosetests]
9 verbose=True
9 verbose=False
10 verbosity=2
10 verbosity=2
11 with-pylons=test.ini
11 with-pylons=test.ini
12 detailed-errors=1
12 detailed-errors=0
13 nologcapture=1
13
14
14 # Babel configuration
15 # Babel configuration
15 [compile_catalog]
16 [compile_catalog]
General Comments 0
You need to be logged in to leave comments. Login now