From 9afb1d8239a6d955dfa2eb2b1a0a92725b906ed4 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 4 Aug 2022 19:04:48 +0200 Subject: [PATCH] tests: Fix style warnings around assert usage assert is not a function. Latest pycodestyle and flake8 warn about this. Signed-off-by: Jan Kiszka --- tests/test_build_system.py | 6 +++--- tests/test_commands.py | 18 +++++++++--------- tests/test_environment_variables.py | 4 ++-- tests/test_layers.py | 10 +++++----- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/test_build_system.py b/tests/test_build_system.py index 1f8d98d..772a3d3 100644 --- a/tests/test_build_system.py +++ b/tests/test_build_system.py @@ -33,12 +33,12 @@ def test_build_system(changedir, tmpdir): kas.kas(['shell', 'test-oe.yml', '-c', 'true']) with open('build-env', 'r') as f: - assert(f.readline().strip() == 'openembedded') + assert f.readline().strip() == 'openembedded' kas.kas(['shell', 'test-isar.yml', '-c', 'true']) with open('build-env', 'r') as f: - assert(f.readline().strip() == 'isar') + assert f.readline().strip() == 'isar' kas.kas(['shell', 'test-openembedded.yml', '-c', 'true']) with open('build-env', 'r') as f: - assert(f.readline().strip() == 'openembedded') + assert f.readline().strip() == 'openembedded' diff --git a/tests/test_commands.py b/tests/test_commands.py index 03f0b67..d045e3f 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -36,11 +36,11 @@ def test_for_all_repos(changedir, tmpdir): >> %s/ref_${KAS_REPO_NAME}; fi''' % (tdir)]) with open('ref_kas_1.0', 'r') as f: - assert(f.readline().strip() - == '907816a5c4094b59a36aec12226e71c461c05b77') + assert f.readline().strip() \ + == '907816a5c4094b59a36aec12226e71c461c05b77' with open('ref_kas_1.1', 'r') as f: - assert(f.readline().strip() - == 'e9ca55a239caa1a2098e1d48773a29ea53c6cab2') + assert f.readline().strip() \ + == 'e9ca55a239caa1a2098e1d48773a29ea53c6cab2' def test_checkout(changedir, tmpdir): @@ -53,11 +53,11 @@ def test_checkout(changedir, tmpdir): # Ensure that local.conf and bblayers.conf are populated, check that no # build has been executed by ensuring that no tmp, sstate-cache or # downloads directories are present. - assert(os.path.exists('build/conf/local.conf')) - assert(os.path.exists('build/conf/bblayers.conf')) - assert(not glob.glob('build/tmp*')) - assert(not os.path.exists('build/downloads')) - assert(not os.path.exists('build/sstate-cache')) + assert os.path.exists('build/conf/local.conf') + assert os.path.exists('build/conf/bblayers.conf') + assert not glob.glob('build/tmp*') + assert not os.path.exists('build/downloads') + assert not os.path.exists('build/sstate-cache') def test_repo_includes(changedir, tmpdir): diff --git a/tests/test_environment_variables.py b/tests/test_environment_variables.py index ad418f2..d965f7a 100644 --- a/tests/test_environment_variables.py +++ b/tests/test_environment_variables.py @@ -12,7 +12,7 @@ def test_build_dir_is_placed_inside_work_dir_by_default(changedir, tmpdir): kas.kas(['checkout', 'test.yml']) - assert(os.path.exists(os.path.join(os.getcwd(), 'build', 'conf'))) + assert os.path.exists(os.path.join(os.getcwd(), 'build', 'conf')) def test_build_dir_can_be_specified_by_environment_variable(changedir, tmpdir): @@ -27,4 +27,4 @@ def test_build_dir_can_be_specified_by_environment_variable(changedir, tmpdir): kas.kas(['checkout', 'test.yml']) del os.environ['KAS_BUILD_DIR'] - assert(os.path.exists(os.path.join(build_dir, 'conf'))) + assert os.path.exists(os.path.join(build_dir, 'conf')) diff --git a/tests/test_layers.py b/tests/test_layers.py index 4ccb208..a370daa 100644 --- a/tests/test_layers.py +++ b/tests/test_layers.py @@ -46,7 +46,7 @@ def test_layers_default(dokas): for line in f: if '{}/kas '.format(LAYERBASE) in line: match += 1 - assert(match == 1) + assert match == 1 def test_layers_include(dokas): @@ -55,17 +55,17 @@ def test_layers_include(dokas): for line in f: if '{}/kas1/meta-'.format(LAYERBASE) in line: match += 1 - assert(match == 2) + assert match == 2 def test_layers_exclude(dokas): with open('build/conf/bblayers.conf', 'r') as f: for line in f: - assert('{}/kas2'.format(LAYERBASE) not in line) + assert '{}/kas2'.format(LAYERBASE) not in line def test_layers_strip_dot(dokas): with open('build/conf/bblayers.conf', 'r') as f: lines = f.readlines() - assert(any('{}/kas3 '.format(LAYERBASE) in x for x in lines)) - assert(any('{}/kas3/meta-bar'.format(LAYERBASE) in x for x in lines)) + assert any('{}/kas3 '.format(LAYERBASE) in x for x in lines) + assert any('{}/kas3/meta-bar'.format(LAYERBASE) in x for x in lines)