mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1227367 - Test exit codes in marionette-client runtests.cli; r=automatedtester
Initial tests for the Marionette Python runner/harness. MozReview-Commit-ID: 9KSSOOmpzUF --HG-- extra : rebase_source : 65998f4f67aaed8aa011410fcee5ddfda6b1aa17 extra : histedit_source : 5ecd5ddae826a11ae7f5c89701ee74e9f68682e6
This commit is contained in:
parent
aa408de276
commit
28b29c74c8
@ -0,0 +1,32 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
import pytest
|
||||
|
||||
from marionette import runtests
|
||||
|
||||
@pytest.fixture
|
||||
def harness_class(request):
|
||||
failures = request.getfuncargvalue('num_failures')
|
||||
|
||||
class Harness(object):
|
||||
def __init__(*args, **kwargs):
|
||||
pass
|
||||
|
||||
def run(*args, **kwargs):
|
||||
if failures is None:
|
||||
raise Exception
|
||||
else:
|
||||
return failures
|
||||
|
||||
return Harness
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"num_failures,exit_code",
|
||||
[(0, 0), (1, 10), (None, 1)],
|
||||
)
|
||||
def test_cli_exit_code(num_failures, exit_code, harness_class):
|
||||
with pytest.raises(SystemExit) as err:
|
||||
runtests.cli(harness_class=harness_class)
|
||||
assert err.value.code == exit_code
|
Loading…
Reference in New Issue
Block a user