-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
104 changed files
with
1,161 additions
and
682 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,5 @@ TAGS | |
TAGS | ||
.cache | ||
.pytest_cache | ||
AUTHORS | ||
ChangeLog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,4 @@ deploy: | |
on: | ||
tags: true | ||
repo: getslash/slash | ||
python: "3.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,50 @@ | ||
from . import markers | ||
|
||
from ..ctx import context | ||
|
||
from .fixtures.parameters import Parametrization | ||
from ..exceptions import UnknownFixtures | ||
from .fixtures.parameters import Parametrization | ||
from . import markers | ||
|
||
|
||
def exclude(name, values): | ||
def exclude(names, values): | ||
""" | ||
Excludes a specific parametrization of a test from running | ||
:param name: can receive either a name of a parameter for this test, or a name of a fixture parameter | ||
:param values: must be a list of values to exclude for the given parameter | ||
""" | ||
return markers.exclude_marker((name, values)) | ||
if not isinstance(values, (tuple, list)): | ||
raise RuntimeError('Invalid exclude values specified: must be a sequence, got {!r}'.format(values)) | ||
if not isinstance(names, (tuple, list)): | ||
names = (names,) | ||
values = [(value,) for value in values] | ||
elif not isinstance(values, (tuple, list)) or any(not isinstance(item, tuple) for item in values): | ||
raise RuntimeError('Invalid exclude values specified for {}: {!r}'.format(', '.join(names), values)) | ||
|
||
values = [tuple(value_set) for value_set in values] | ||
return markers.exclude_marker((names, values)) | ||
|
||
def is_excluded(test): | ||
test_func = test.get_test_function() | ||
exclusions = markers.exclude_marker.get_value(test_func, default=None) | ||
if not exclusions: | ||
return False | ||
exclusions = dict(exclusions) | ||
for parameter_name, values in exclusions.items(): | ||
param = context.session.fixture_store.resolve_name(parameter_name, start_point=test_func, namespace=test.get_fixture_namespace()) | ||
if not isinstance(param, Parametrization): | ||
raise UnknownFixtures('{!r} is not a parameter, and therefore cannot be the base for value exclusions'.format(parameter_name)) | ||
try: | ||
param_index = test.__slash__.variation.param_value_indices[param.info.id] #pylint: disable=no-member | ||
except LookupError: | ||
raise UnknownFixtures('{!r} cannot be excluded for {!r}'.format(parameter_name, test)) | ||
value = param.get_value_by_index(param_index) | ||
if value in values: | ||
for parameter_names, value_sets in exclusions.items(): | ||
params = [] | ||
values = [] | ||
for parameter_name in parameter_names: | ||
param = context.session.fixture_store.resolve_name(parameter_name, start_point=test_func, namespace=test.get_fixture_namespace()) | ||
if not isinstance(param, Parametrization): | ||
raise UnknownFixtures('{!r} is not a parameter, and therefore cannot be the base for value exclusions'.format(parameter_name)) | ||
params.append(param) | ||
|
||
|
||
try: | ||
param_index = test.__slash__.variation.param_value_indices[param.info.id] #pylint: disable=no-member | ||
except LookupError: | ||
raise UnknownFixtures('{!r} cannot be excluded for {!r}'.format(parameter_name, test)) | ||
value = param.get_value_by_index(param_index) | ||
values.append(value) | ||
|
||
if tuple(values) in value_sets: | ||
return True | ||
return False |
Oops, something went wrong.