Adapt all python code to PEP8 style standards

Signed-off-by: Kamil Lepek <kamil.lepek94@gmail.com>
This commit is contained in:
Kamil Lepek
2019-06-10 15:49:15 +02:00
parent 1e2b8f1980
commit e52d34c1c8
15 changed files with 822 additions and 765 deletions

View File

@@ -10,13 +10,15 @@ import os
import sys
import subprocess
def run_command(args):
result = subprocess.run(" ".join(args), shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result.stdout = result.stdout.decode("ASCII", errors='ignore')
result.stderr = result.stderr.decode("ASCII", errors='ignore')
return result
script_path = os.path.dirname(os.path.realpath(__file__))
main_UT_dir = os.path.join(script_path, tests_config.MAIN_DIRECTORY_OF_UNIT_TESTS)
@@ -29,13 +31,13 @@ if not os.path.isdir(os.path.join(main_UT_dir, "ocf_env", "ocf")):
except Exception:
raise Exception("Cannot create ocf_env/ocf directory!")
result = run_command([ "cp", "-r",
os.path.join(main_tested_dir, "inc", "*"),
os.path.join(main_UT_dir, "ocf_env", "ocf") ])
result = run_command(["cp", "-r",
os.path.join(main_tested_dir, "inc", "*"),
os.path.join(main_UT_dir, "ocf_env", "ocf")])
if result.returncode != 0:
raise Exception("Preparing sources for testing failed!")
result = run_command([ os.path.join(script_path, "prepare_sources_for_testing.py") ])
result = run_command([os.path.join(script_path, "prepare_sources_for_testing.py")])
if result.returncode != 0:
raise Exception("Preparing sources for testing failed!")
@@ -52,7 +54,7 @@ except Exception:
os.chdir(build_dir)
cmake_result = run_command([ "cmake", ".." ])
cmake_result = run_command(["cmake", ".."])
print(cmake_result.stdout)
with open(os.path.join(logs_dir, "cmake.output"), "w") as f:
@@ -64,20 +66,20 @@ if cmake_result.returncode != 0:
f.write("Cmake step failed! More details in cmake.output.")
sys.exit(1)
make_result = run_command([ "make", "-j" ])
make_result = run_command(["make", "-j"])
print(make_result.stdout)
with open(os.path.join(logs_dir, "make.output"), "w") as f:
f.write(make_result.stdout)
f.write(make_result.stderr)
f.write(make_result.stdout)
f.write(make_result.stderr)
if make_result.returncode != 0:
with open(os.path.join(logs_dir, "tests.output"), "w") as f:
f.write("Make step failed! More details in make.output.")
sys.exit(1)
with open(os.path.join(logs_dir, "tests.output"), "w") as f:
f.write("Make step failed! More details in make.output.")
sys.exit(1)
test_result = run_command([ "make", "test" ])
test_result = run_command(["make", "test"])
print(test_result.stdout)
with open(os.path.join(logs_dir , "tests.output"), "w") as f:
f.write(test_result.stdout)
with open(os.path.join(logs_dir, "tests.output"), "w") as f:
f.write(test_result.stdout)