test: avoid shadowing globals
Lets not use `input` as variable name, since it shadows the python global `input`. Use a different variable name and make pylint happy.
This commit is contained in:
parent
72be939521
commit
eb4d90cf94
2 changed files with 6 additions and 6 deletions
|
|
@ -32,7 +32,7 @@ class TestCase(unittest.TestCase):
|
||||||
if not os.getenv("OSBUILD_TEST_STORE"):
|
if not os.getenv("OSBUILD_TEST_STORE"):
|
||||||
shutil.rmtree(self.store)
|
shutil.rmtree(self.store)
|
||||||
|
|
||||||
def run_osbuild(self, pipeline, input=None):
|
def run_osbuild(self, pipeline, input_data=None):
|
||||||
osbuild_cmd = ["python3", "-m", "osbuild", "--json", "--store", self.store, "--libdir", ".", pipeline]
|
osbuild_cmd = ["python3", "-m", "osbuild", "--json", "--store", self.store, "--libdir", ".", pipeline]
|
||||||
|
|
||||||
build_env = os.getenv("OSBUILD_TEST_BUILD_ENV", None)
|
build_env = os.getenv("OSBUILD_TEST_BUILD_ENV", None)
|
||||||
|
|
@ -43,8 +43,8 @@ class TestCase(unittest.TestCase):
|
||||||
# Create a checkpoint at the last stage, i.e.
|
# Create a checkpoint at the last stage, i.e.
|
||||||
# commit the final tree to the store, so that
|
# commit the final tree to the store, so that
|
||||||
# tests can use it to compare against
|
# tests can use it to compare against
|
||||||
if input:
|
if input_data:
|
||||||
manifest = json.loads(input)
|
manifest = json.loads(input_data)
|
||||||
else:
|
else:
|
||||||
with open(pipeline, "r") as f:
|
with open(pipeline, "r") as f:
|
||||||
manifest = json.load(f)
|
manifest = json.load(f)
|
||||||
|
|
@ -54,11 +54,11 @@ class TestCase(unittest.TestCase):
|
||||||
osbuild_cmd.append("--checkpoint")
|
osbuild_cmd.append("--checkpoint")
|
||||||
osbuild_cmd.append(parsed.tree_id)
|
osbuild_cmd.append(parsed.tree_id)
|
||||||
|
|
||||||
stdin = subprocess.PIPE if input else None
|
stdin = subprocess.PIPE if input_data else None
|
||||||
|
|
||||||
p = subprocess.Popen(osbuild_cmd, encoding="utf-8", stdin=stdin, stdout=subprocess.PIPE)
|
p = subprocess.Popen(osbuild_cmd, encoding="utf-8", stdin=stdin, stdout=subprocess.PIPE)
|
||||||
try:
|
try:
|
||||||
output, _ = p.communicate(input)
|
output, _ = p.communicate(input_data)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print(output)
|
print(output)
|
||||||
self.assertEqual(p.returncode, 0)
|
self.assertEqual(p.returncode, 0)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class TestAssemblers(osbuildtest.TestCase):
|
||||||
with open("test/pipelines/f30-base.json") as f:
|
with open("test/pipelines/f30-base.json") as f:
|
||||||
base = json.load(f)
|
base = json.load(f)
|
||||||
base["pipeline"] = dict(base["pipeline"], assembler={"name": name, "options": options})
|
base["pipeline"] = dict(base["pipeline"], assembler={"name": name, "options": options})
|
||||||
return self.run_osbuild("-", input=json.dumps(base))
|
return self.run_osbuild("-", input_data=json.dumps(base))
|
||||||
|
|
||||||
def assertImageFile(self, filename, fmt, expected_size=None):
|
def assertImageFile(self, filename, fmt, expected_size=None):
|
||||||
info = json.loads(subprocess.check_output(["qemu-img", "info", "--output", "json", filename]))
|
info = json.loads(subprocess.check_output(["qemu-img", "info", "--output", "json", filename]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue