From 122177153b14664a0e4fed85aa4f22b87cfabf56 Mon Sep 17 00:00:00 2001 From: Chandan Singh Date: Mon, 11 Nov 2019 17:07:09 +0000 Subject: 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. --- tests/integration/manual.py | 164 ++++++++++++++++++++++---------------------- 1 file changed, 81 insertions(+), 83 deletions(-) (limited to 'tests/integration/manual.py') diff --git a/tests/integration/manual.py b/tests/integration/manual.py index 2ac7f74d0..c6a84b062 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -13,141 +13,139 @@ from buildstream.testing._utils.site import HAVE_SANDBOX pytestmark = pytest.mark.integration -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - "project" -) +DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project") def create_manual_element(name, path, config, variables, environment): element = { - 'kind': 'manual', - 'depends': [{ - 'filename': 'base.bst', - 'type': 'build' - }], - 'config': config, - 'variables': variables, - 'environment': environment + "kind": "manual", + "depends": [{"filename": "base.bst", "type": "build"}], + "config": config, + "variables": variables, + "environment": environment, } os.makedirs(os.path.dirname(os.path.join(path, name)), exist_ok=True) _yaml.roundtrip_dump(element, os.path.join(path, name)) @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') +@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") def test_manual_element(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') - element_path = os.path.join(project, 'elements') - element_name = 'import/import.bst' - - create_manual_element(element_name, element_path, { - 'configure-commands': ["echo './configure' >> test"], - 'build-commands': ["echo 'make' >> test"], - 'install-commands': [ - "echo 'make install' >> test", - "cp test %{install-root}" - ], - 'strip-commands': ["echo 'strip' >> %{install-root}/test"] - }, {}, {}) - - res = cli.run(project=project, args=['build', element_name]) + checkout = os.path.join(cli.directory, "checkout") + element_path = os.path.join(project, "elements") + element_name = "import/import.bst" + + create_manual_element( + element_name, + element_path, + { + "configure-commands": ["echo './configure' >> test"], + "build-commands": ["echo 'make' >> test"], + "install-commands": ["echo 'make install' >> test", "cp test %{install-root}"], + "strip-commands": ["echo 'strip' >> %{install-root}/test"], + }, + {}, + {}, + ) + + res = cli.run(project=project, args=["build", element_name]) assert res.exit_code == 0 - cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) + cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout]) assert res.exit_code == 0 - with open(os.path.join(checkout, 'test')) as f: + with open(os.path.join(checkout, "test")) as f: text = f.read() - assert text == """./configure + assert ( + text + == """./configure make make install strip """ + ) @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') +@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") def test_manual_element_environment(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') - element_path = os.path.join(project, 'elements') - element_name = 'import/import.bst' - - create_manual_element(element_name, element_path, { - 'install-commands': [ - "echo $V >> test", - "cp test %{install-root}" - ] - }, { - }, { - 'V': 2 - }) - - res = cli.run(project=project, args=['build', element_name]) + checkout = os.path.join(cli.directory, "checkout") + element_path = os.path.join(project, "elements") + element_name = "import/import.bst" + + create_manual_element( + element_name, element_path, {"install-commands": ["echo $V >> test", "cp test %{install-root}"]}, {}, {"V": 2} + ) + + res = cli.run(project=project, args=["build", element_name]) assert res.exit_code == 0 - cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) + cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout]) assert res.exit_code == 0 - with open(os.path.join(checkout, 'test')) as f: + with open(os.path.join(checkout, "test")) as f: text = f.read() assert text == "2\n" @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') +@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") def test_manual_element_noparallel(cli, datafiles): project = str(datafiles) - checkout = os.path.join(cli.directory, 'checkout') - element_path = os.path.join(project, 'elements') - element_name = 'import/import.bst' - - create_manual_element(element_name, element_path, { - 'install-commands': [ - "echo $MAKEFLAGS >> test", - "echo $V >> test", - "cp test %{install-root}" - ] - }, { - 'notparallel': True - }, { - 'MAKEFLAGS': '-j%{max-jobs} -Wall', - 'V': 2 - }) - - res = cli.run(project=project, args=['build', element_name]) + checkout = os.path.join(cli.directory, "checkout") + element_path = os.path.join(project, "elements") + element_name = "import/import.bst" + + create_manual_element( + element_name, + element_path, + {"install-commands": ["echo $MAKEFLAGS >> test", "echo $V >> test", "cp test %{install-root}"]}, + {"notparallel": True}, + {"MAKEFLAGS": "-j%{max-jobs} -Wall", "V": 2}, + ) + + res = cli.run(project=project, args=["build", element_name]) assert res.exit_code == 0 - cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkout]) + cli.run(project=project, args=["artifact", "checkout", element_name, "--directory", checkout]) assert res.exit_code == 0 - with open(os.path.join(checkout, 'test')) as f: + with open(os.path.join(checkout, "test")) as f: text = f.read() - assert text == """-j1 -Wall + assert ( + text + == """-j1 -Wall 2 """ + ) @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') +@pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") def test_manual_element_logging(cli, datafiles): project = str(datafiles) - element_path = os.path.join(project, 'elements') - element_name = 'import/import.bst' - - create_manual_element(element_name, element_path, { - 'configure-commands': ["echo configure"], - 'build-commands': ["echo build"], - 'install-commands': ["echo install"], - 'strip-commands': ["echo strip"] - }, {}, {}) - - res = cli.run(project=project, args=['build', element_name]) + element_path = os.path.join(project, "elements") + element_name = "import/import.bst" + + create_manual_element( + element_name, + element_path, + { + "configure-commands": ["echo configure"], + "build-commands": ["echo build"], + "install-commands": ["echo install"], + "strip-commands": ["echo strip"], + }, + {}, + {}, + ) + + res = cli.run(project=project, args=["build", element_name]) assert res.exit_code == 0 # Verify that individual commands are logged -- cgit v1.2.1