Example #1
0
        def setUp(self, port=None):
            """If no port is specified, use a semi-random port and subdirectory
            'testenv'; but if a port is specified, use that port and
            subdirectory 'testenv<portnum>'.
            """
            if port is None:
                try:
                    port = int(os.getenv('TRAC_TEST_PORT'))
                except (TypeError, ValueError):
                    pass

            env_path = os.getenv('TRAC_TEST_ENV_PATH')
            if not env_path:
                env_name = 'testenv%s' % (port or '')
                env_path = os.path.join(trac_source_tree, env_name)
            else:
                env_path += str(port or '')

            if port is None:
                port = 8000 + os.getpid() % 1000

            baseurl = "http://127.0.0.1:%s" % port
            self._testenv = self.env_class(env_path, port, baseurl)

            # functional-testing.log gets the twill output
            self.functional_test_log = \
                os.path.join(env_path, 'functional-testing.log')
            twill.set_output(open(self.functional_test_log, 'w'))

            self._testenv.start()
            self._tester = self.tester_class(baseurl)
            self.fixture = (self._testenv, self._tester)
            self._testenv.set_config('project', 'name', 'Functional Tests')
Example #2
0
 def _setup_logging(self):
     "Create the log files which capture output from subprocesses."
     self.logfile = open(os.path.join(self.dirname, 'testing.log'), 'a')
     twill_log = os.path.join(self.dirname, 'functional-testing.log')
     twill.set_output(open(twill_log, 'w'))
Example #3
0
    print "SKIP: fine-grained permission tests (ConfigObj not installed)"

from trac.test import TestSetup, TestCaseSetup
from trac.tests.contentgen import random_sentence, random_page, random_word, \
    random_unique_camel

internal_error = 'Trac detected an internal error:'

trac_source_tree = os.path.normpath(os.path.join(trac.__file__, '..', '..'))

# testing.log gets any unused output from subprocesses
logfile = open(os.path.join(trac_source_tree, 'testing.log'), 'w')

if twill:
    # functional-testing.log gets the twill output
    twill.set_output(
        open(os.path.join(trac_source_tree, 'functional-testing.log'), 'w'))

    from trac.tests.functional.testenv import FunctionalTestEnvironment
    from trac.tests.functional.svntestenv import SvnFunctionalTestEnvironment

    from trac.tests.functional.tester import FunctionalTester

    class FunctionalTestSuite(TestSetup):
        """TestSuite that provides a test fixture containing a
        FunctionalTestEnvironment and a FunctionalTester.
        """

        if has_svn:
            env_class = SvnFunctionalTestEnvironment
        else:
            env_class = FunctionalTestEnvironment
Example #4
0
 def _setup_logging(self):
     "Create the log files which capture output from subprocesses."
     self.logfile = open(os.path.join(self.dirname, 'testing.log'), 'a')
     twill_log = os.path.join(self.dirname, 'functional-testing.log')
     twill.set_output(open(twill_log, 'w'))