summaryrefslogtreecommitdiff
path: root/tests/format/optioneltmask.py
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2019-11-11 17:07:09 +0000
committerChandan Singh <chandan@chandansingh.net>2019-11-14 21:21:06 +0000
commit122177153b14664a0e4fed85aa4f22b87cfabf56 (patch)
tree032c2e46825af91f6fe27f22b5b567eea2b7935d /tests/format/optioneltmask.py
parenta3ee349558f36a220f79665873b36c1b0f990c8e (diff)
downloadbuildstream-122177153b14664a0e4fed85aa4f22b87cfabf56.tar.gz
Reformat code using Black
As discussed over the mailing list, reformat code using Black. This is a one-off change to reformat all our codebase. Moving forward, we shouldn't expect such blanket reformats. Rather, we expect each change to already comply with the Black formatting style.
Diffstat (limited to 'tests/format/optioneltmask.py')
-rw-r--r--tests/format/optioneltmask.py82
1 files changed, 35 insertions, 47 deletions
diff --git a/tests/format/optioneltmask.py b/tests/format/optioneltmask.py
index 75265fdd7..399b37b97 100644
--- a/tests/format/optioneltmask.py
+++ b/tests/format/optioneltmask.py
@@ -12,73 +12,61 @@ DATA_DIR = os.path.dirname(os.path.realpath(__file__))
@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.parametrize("target,value,expected", [
- ('pony.bst', 'pony.bst', 'True'),
- ('horsy.bst', 'pony.bst, horsy.bst', 'True'),
- ('zebry.bst', 'pony.bst, horsy.bst', 'False'),
-])
+@pytest.mark.parametrize(
+ "target,value,expected",
+ [
+ ("pony.bst", "pony.bst", "True"),
+ ("horsy.bst", "pony.bst, horsy.bst", "True"),
+ ("zebry.bst", "pony.bst, horsy.bst", "False"),
+ ],
+)
def test_conditional_cli(cli, datafiles, target, value, expected):
- project = os.path.join(datafiles.dirname, datafiles.basename, 'option-element-mask')
- result = cli.run(project=project, silent=True, args=[
- '--option', 'debug_elements', value,
- 'show',
- '--deps', 'none',
- '--format', '%{vars}',
- target])
+ project = os.path.join(datafiles.dirname, datafiles.basename, "option-element-mask")
+ result = cli.run(
+ project=project,
+ silent=True,
+ args=["--option", "debug_elements", value, "show", "--deps", "none", "--format", "%{vars}", target],
+ )
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert loaded.get_str('debug') == expected
+ assert loaded.get_str("debug") == expected
@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.parametrize("target,value,expected", [
- ('pony.bst', ['pony.bst'], 'True'),
- ('horsy.bst', ['pony.bst', 'horsy.bst'], 'True'),
- ('zebry.bst', ['pony.bst', 'horsy.bst'], 'False'),
-])
+@pytest.mark.parametrize(
+ "target,value,expected",
+ [
+ ("pony.bst", ["pony.bst"], "True"),
+ ("horsy.bst", ["pony.bst", "horsy.bst"], "True"),
+ ("zebry.bst", ["pony.bst", "horsy.bst"], "False"),
+ ],
+)
def test_conditional_config(cli, datafiles, target, value, expected):
- project = os.path.join(datafiles.dirname, datafiles.basename, 'option-element-mask')
- cli.configure({
- 'projects': {
- 'test': {
- 'options': {
- 'debug_elements': value
- }
- }
- }
- })
- result = cli.run(project=project, silent=True, args=[
- 'show',
- '--deps', 'none',
- '--format', '%{vars}',
- target])
+ project = os.path.join(datafiles.dirname, datafiles.basename, "option-element-mask")
+ cli.configure({"projects": {"test": {"options": {"debug_elements": value}}}})
+ result = cli.run(project=project, silent=True, args=["show", "--deps", "none", "--format", "%{vars}", target])
result.assert_success()
loaded = _yaml.load_data(result.output)
- assert loaded.get_str('debug') == expected
+ assert loaded.get_str("debug") == expected
@pytest.mark.datafiles(DATA_DIR)
def test_invalid_declaration(cli, datafiles):
- project = os.path.join(datafiles.dirname, datafiles.basename, 'option-element-mask-invalid')
- result = cli.run(project=project, silent=True, args=[
- 'show',
- '--deps', 'none',
- '--format', '%{vars}',
- 'pony.bst'])
+ project = os.path.join(datafiles.dirname, datafiles.basename, "option-element-mask-invalid")
+ result = cli.run(project=project, silent=True, args=["show", "--deps", "none", "--format", "%{vars}", "pony.bst"])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
@pytest.mark.datafiles(DATA_DIR)
def test_invalid_value(cli, datafiles):
- project = os.path.join(datafiles.dirname, datafiles.basename, 'option-element-mask')
- result = cli.run(project=project, silent=True, args=[
- '--option', 'debug_elements', 'kitten.bst',
- 'show',
- '--deps', 'none',
- '--format', '%{vars}',
- 'pony.bst'])
+ project = os.path.join(datafiles.dirname, datafiles.basename, "option-element-mask")
+ result = cli.run(
+ project=project,
+ silent=True,
+ args=["--option", "debug_elements", "kitten.bst", "show", "--deps", "none", "--format", "%{vars}", "pony.bst"],
+ )
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)