summaryrefslogtreecommitdiff
path: root/tests/integration/manual.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/integration/manual.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/integration/manual.py')
-rw-r--r--tests/integration/manual.py164
1 files changed, 81 insertions, 83 deletions
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