示例#1
0
def test_bokchoy(options, passthrough_options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some static asset steps if `fasttest` is True.
    Using 'serversonly' will prepare and run servers, leaving a process running in the terminal. At
        the same time, a user can open a separate terminal and use 'testsonly' for executing tests against
        those running servers.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    # Note: Bok Choy uses firefox if SELENIUM_BROWSER is not set. So we are using
    # firefox as the default here.
    using_firefox = (os.environ.get('SELENIUM_BROWSER', 'firefox') == 'firefox')
    validate_firefox = getattr(options, 'validate_firefox_version', using_firefox)
    options.test_bokchoy.coveragerc = options.get('coveragerc', None)

    if validate_firefox:
        check_firefox_version()

    run_bokchoy(options.test_bokchoy, passthrough_options)
def test_bokchoy(options, passthrough_options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some static asset steps if `fasttest` is True.
    Using 'serversonly' will prepare and run servers, leaving a process running in the terminal. At
        the same time, a user can open a separate terminal and use 'testsonly' for executing tests against
        those running servers.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    # Note: Bok Choy uses firefox if SELENIUM_BROWSER is not set. So we are using
    # firefox as the default here.
    using_firefox = (os.environ.get('SELENIUM_BROWSER',
                                    'firefox') == 'firefox')
    validate_firefox = getattr(options, 'validate_firefox_version',
                               using_firefox)
    options.test_bokchoy.coveragerc = options.get('coveragerc', None)

    if validate_firefox:
        check_firefox_version()

    if hasattr(options.test_bokchoy, 'with_wtw'):
        call_task('fetch_coverage_test_selection_data',
                  options={'compare_branch': options.test_bokchoy.with_wtw})

    run_bokchoy(options.test_bokchoy, passthrough_options)
示例#3
0
def test_bokchoy(options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some static asset steps if `fasttest` is True.
    Using 'serversonly' will prepare and run servers, leaving a process running in the terminal. At
        the same time, a user can open a separate terminal and use 'testsonly' for executing tests against
        those running servers.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    # Note: Bok Choy uses firefox if SELENIUM_BROWSER is not set. So we are using
    # firefox as the default here.
    using_firefox = (os.environ.get('SELENIUM_BROWSER',
                                    'firefox') == 'firefox')
    validate_firefox = getattr(options, 'validate_firefox_version',
                               using_firefox)

    if validate_firefox:
        check_firefox_version()

    opts = parse_bokchoy_opts(options)
    run_bokchoy(**opts)
示例#4
0
def test_bokchoy(options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some setup if `fasttest` is True.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    if getattr(options, 'validate_firefox_version', True):
        check_firefox_version()
        
    opts = {
        'test_spec': getattr(options, 'test_spec', None),
        'fasttest': getattr(options, 'fasttest', False),
        'verbosity': getattr(options, 'verbosity', 2),
        'extra_args': getattr(options, 'extra_args', ''),
        'test_dir': 'tests',
    }

    test_suite = BokChoyTestSuite('bok-choy', **opts)
    test_suite.run()
示例#5
0
def test_bokchoy(options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some setup if `fasttest` is True.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    # Note: Bok Choy uses firefox if SELENIUM_BROWSER is not set. So we are using
    # firefox as the default here.
    using_firefox = (os.environ.get('SELENIUM_BROWSER', 'firefox') == 'firefox')
    validate_firefox = getattr(options, 'validate_firefox_version', using_firefox)

    if validate_firefox:
        check_firefox_version()

    opts = {
        'test_spec': getattr(options, 'test_spec', None),
        'fasttest': getattr(options, 'fasttest', False),
        'default_store': getattr(options, 'default_store', 'split'),
        'verbosity': getattr(options, 'verbosity', 2),
        'extra_args': getattr(options, 'extra_args', ''),
        'test_dir': 'tests',
    }
    run_bokchoy(**opts)
示例#6
0
 def test_firefox_version_below_expected(self, _mock_subprocesss):
     test_version = MINIMUM_FIREFOX_VERSION - 1
     _mock_subprocesss.return_value = "Mozilla Firefox {version}".format(
         version=test_version
     )
     with self.assertRaises(Exception):
         check_firefox_version()
示例#7
0
 def test_firefox_version_ok(self, _mock_subprocesss):
     test_version = MINIMUM_FIREFOX_VERSION
     _mock_subprocesss.return_value = "Mozilla Firefox {version}".format(
         version=str(test_version)
     )
     # No exception should be raised
     check_firefox_version()
示例#8
0
def test_bokchoy(options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some setup if `fasttest` is True.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    if getattr(options, 'validate_firefox_version', True):
        check_firefox_version()

    opts = {
        'test_spec': getattr(options, 'test_spec', None),
        'fasttest': getattr(options, 'fasttest', False),
        'verbosity': getattr(options, 'verbosity', 2),
        'extra_args': getattr(options, 'extra_args', ''),
        'test_dir': 'tests',
    }

    test_suite = BokChoyTestSuite('bok-choy', **opts)
    test_suite.run()
示例#9
0
def test_bokchoy(options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some setup if `fasttest` is True.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    # Note: Bok Choy uses firefox if SELENIUM_BROWSER is not set. So we are using
    # firefox as the default here.
    using_firefox = (os.environ.get('SELENIUM_BROWSER',
                                    'firefox') == 'firefox')
    validate_firefox = getattr(options, 'validate_firefox_version',
                               using_firefox)

    if validate_firefox:
        check_firefox_version()

    opts = {
        'test_spec': getattr(options, 'test_spec', None),
        'fasttest': getattr(options, 'fasttest', False),
        'default_store': getattr(options, 'default_store', 'split'),
        'verbosity': getattr(options, 'verbosity', 2),
        'extra_args': getattr(options, 'extra_args', ''),
        'pdb': getattr(options, 'pdb', False),
        'test_dir': 'tests',
    }
    run_bokchoy(**opts)
示例#10
0
def test_bokchoy(options):
    """
    Run acceptance tests that use the bok-choy framework.
    Skips some static asset steps if `fasttest` is True.
    Using 'serversonly' will prepare and run servers, leaving a process running in the terminal. At
        the same time, a user can open a separate terminal and use 'testsonly' for executing tests against
        those running servers.

    `test_spec` is a nose-style test specifier relative to the test directory
    Examples:
    - path/to/test.py
    - path/to/test.py:TestFoo
    - path/to/test.py:TestFoo.test_bar
    It can also be left blank to run all tests in the suite.
    """
    # Note: Bok Choy uses firefox if SELENIUM_BROWSER is not set. So we are using
    # firefox as the default here.
    using_firefox = (os.environ.get('SELENIUM_BROWSER', 'firefox') == 'firefox')
    validate_firefox = getattr(options, 'validate_firefox_version', using_firefox)

    if validate_firefox:
        check_firefox_version()

    opts = {
        'test_spec': getattr(options, 'test_spec', None),
        'num_processes': int(getattr(options, 'num_processes', 1)),
        'fasttest': getattr(options, 'fasttest', False),
        'serversonly': getattr(options, 'serversonly', False),
        'testsonly': getattr(options, 'testsonly', False),
        'default_store': getattr(options, 'default_store', 'split'),
        'verbosity': getattr(options, 'verbosity', 2),
        'extra_args': getattr(options, 'extra_args', ''),
        'pdb': getattr(options, 'pdb', False),
        'test_dir': getattr(options, 'test_dir', 'tests'),
    }
    run_bokchoy(**opts)
示例#11
0
 def test_firefox_version_bad(self, _mock_subprocesss):
     _mock_subprocesss.return_value = "garbage"
     with self.assertRaises(Exception):
         check_firefox_version()
示例#12
0
 def test_firefox_version_not_detected(self, _mock_subprocesss):
     _mock_subprocesss.return_value = "Mozilla Firefox"
     with self.assertRaises(Exception):
         check_firefox_version()
示例#13
0
 def test_firefox_version_bad(self, _mock_subprocesss):
     _mock_subprocesss.return_value = "garbage"
     with self.assertRaises(Exception):
         check_firefox_version()
示例#14
0
 def test_firefox_version_not_detected(self, _mock_subprocesss):
     _mock_subprocesss.return_value = "Mozilla Firefox"
     with self.assertRaises(Exception):
         check_firefox_version()