global: fix PEP-8 formatting

This patch was generated by running `autopep8 --diff` on the
source tree and then applying the diff.
This commit is contained in:
Christian Kellner 2022-08-04 16:59:11 +02:00
parent bb644cdd07
commit f05078f66e
20 changed files with 36 additions and 28 deletions

View file

@ -13,6 +13,7 @@ from osbuild.util import jsoncomm
class APITester(osbuild.api.BaseAPI):
"""Records the number of messages and if it got cleaned up"""
def __init__(self, sockaddr):
super().__init__(sockaddr)
self.clean = False
@ -33,6 +34,7 @@ class APITester(osbuild.api.BaseAPI):
class TestAPI(unittest.TestCase):
"""Check API infrastructure"""
def setUp(self):
self.tmp = tempfile.TemporaryDirectory()

View file

@ -160,7 +160,6 @@ class TestFormatV1(unittest.TestCase):
self.assertEqual(pl.runner, runner)
check_stage(have, want)
def test_describe(self):
index = osbuild.meta.Index(os.curdir)
@ -412,9 +411,9 @@ class TestFormatV1(unittest.TestCase):
self.assertEqual(res.valid, False)
self.assertEqual(len(res), 2)
lst = res[".pipeline.stages[0].options"]
self.assertEqual(len(lst), 1) # missing rootfs
self.assertEqual(len(lst), 1) # missing rootfs
lst = res[".pipeline.stages[0].options.uefi"]
self.assertEqual(len(lst), 1) # missing "osname"
self.assertEqual(len(lst), 1) # missing "osname"
assembler_check = {
"pipeline": {
@ -431,6 +430,6 @@ class TestFormatV1(unittest.TestCase):
self.assertEqual(res.valid, False)
self.assertEqual(len(res), 2)
lst = res[".pipeline.assembler.options"]
self.assertEqual(len(lst), 1) # missing "filename"
self.assertEqual(len(lst), 1) # missing "filename"
lst = res[".pipeline.assembler.options.compression"]
self.assertEqual(len(lst), 1) # wrong compression method
self.assertEqual(len(lst), 1) # wrong compression method

View file

@ -122,7 +122,7 @@ class TestObjectStore(unittest.TestCase):
with object_store.new() as tree:
path = tree.write()
with tree.write() as path, \
open(os.path.join(path, "data"), "w") as f:
open(os.path.join(path, "data"), "w") as f:
f.write(data)
st = os.fstat(f.fileno())
data_inode = st.st_ino

View file

@ -35,7 +35,6 @@ class TestUtilLorax(test.TestBase):
if not os.path.exists(target):
self.fail(f"Path {target} does not exists")
def test_script(self):
with tempfile.TemporaryDirectory(dir="/var/tmp") as tmp:
root = os.path.join(tmp, "root")
@ -81,7 +80,6 @@ class TestUtilLorax(test.TestBase):
data = f.read().strip()
self.assertEqual(data, "osbuild-42")
def test_script_errors(self):
with tempfile.TemporaryDirectory(dir="/var/tmp") as tmp:
root = os.path.join(tmp, "root")

View file

@ -5,6 +5,7 @@ import os
from osbuild.util import path
def test_in_tree():
cases = {
("/tmp/file", "/tmp", False): True, # Simple, non-existent

View file

@ -6,7 +6,7 @@ from io import StringIO
from osbuild.util.rhsm import Subscriptions
REPO_FILE="""[jpp]
REPO_FILE = """[jpp]
name = Red Hat JBoss Portal
baseurl = https://cdn.redhat.com/1.0/$basearch/os
enabled = 0
@ -66,7 +66,7 @@ def test_from_host_system():
raise e
assert test_case["success"] # Verify this test case should pass
assert test_case["success"] # Verify this test case should pass
assert secrets["ssl_ca_cert"] == "/etc/rhsm/ca/redhat-uep.pem"
assert secrets["ssl_client_key"] == f'/etc/pki/entitlement/{test_case["key"]}-key.pem'
assert secrets["ssl_client_cert"] == f'/etc/pki/entitlement/{test_case["key"]}.pem'

View file

@ -314,8 +314,8 @@ class TestStages(test.TestBase):
for image_name, test_data in checks.items():
with self.osbuild as osb, tempfile.TemporaryDirectory(dir="/var/tmp") as outdir:
osb.compile_file(os.path.join(testdir, "qemu.json"),
exports=[image_name],
output_dir=outdir)
exports=[image_name],
output_dir=outdir)
tree = os.path.join(outdir, image_name)
ip = os.path.join(tree, image_name)
@ -331,8 +331,8 @@ class TestStages(test.TestBase):
qemu_img_out = json.loads(qemu_img_run.stdout)
self.assertTrue(mapping_is_subset(test_data, qemu_img_out),
f"Test data is not a subset of the qemu-img output: {test_data} not <= {qemu_img_run.stdout}"
)
("Test data is not a subset of the qemu-img output: "
f"{test_data} not <= {qemu_img_run.stdout}"))
# cache the downloaded data for the files source
osb.copy_source_data(self.store, "org.osbuild.files")