tests: Fix style warnings around assert usage

assert is not a function. Latest pycodestyle and flake8 warn about this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2022-08-04 19:04:48 +02:00
parent fa8414b660
commit 9afb1d8239
4 changed files with 19 additions and 19 deletions

View File

@ -33,12 +33,12 @@ def test_build_system(changedir, tmpdir):
kas.kas(['shell', 'test-oe.yml', '-c', 'true']) kas.kas(['shell', 'test-oe.yml', '-c', 'true'])
with open('build-env', 'r') as f: 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']) kas.kas(['shell', 'test-isar.yml', '-c', 'true'])
with open('build-env', 'r') as f: 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']) kas.kas(['shell', 'test-openembedded.yml', '-c', 'true'])
with open('build-env', 'r') as f: with open('build-env', 'r') as f:
assert(f.readline().strip() == 'openembedded') assert f.readline().strip() == 'openembedded'

View File

@ -36,11 +36,11 @@ def test_for_all_repos(changedir, tmpdir):
>> %s/ref_${KAS_REPO_NAME}; fi''' % (tdir)]) >> %s/ref_${KAS_REPO_NAME}; fi''' % (tdir)])
with open('ref_kas_1.0', 'r') as f: with open('ref_kas_1.0', 'r') as f:
assert(f.readline().strip() assert f.readline().strip() \
== '907816a5c4094b59a36aec12226e71c461c05b77') == '907816a5c4094b59a36aec12226e71c461c05b77'
with open('ref_kas_1.1', 'r') as f: with open('ref_kas_1.1', 'r') as f:
assert(f.readline().strip() assert f.readline().strip() \
== 'e9ca55a239caa1a2098e1d48773a29ea53c6cab2') == 'e9ca55a239caa1a2098e1d48773a29ea53c6cab2'
def test_checkout(changedir, tmpdir): 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 # Ensure that local.conf and bblayers.conf are populated, check that no
# build has been executed by ensuring that no tmp, sstate-cache or # build has been executed by ensuring that no tmp, sstate-cache or
# downloads directories are present. # downloads directories are present.
assert(os.path.exists('build/conf/local.conf')) assert os.path.exists('build/conf/local.conf')
assert(os.path.exists('build/conf/bblayers.conf')) assert os.path.exists('build/conf/bblayers.conf')
assert(not glob.glob('build/tmp*')) assert not glob.glob('build/tmp*')
assert(not os.path.exists('build/downloads')) assert not os.path.exists('build/downloads')
assert(not os.path.exists('build/sstate-cache')) assert not os.path.exists('build/sstate-cache')
def test_repo_includes(changedir, tmpdir): def test_repo_includes(changedir, tmpdir):

View File

@ -12,7 +12,7 @@ def test_build_dir_is_placed_inside_work_dir_by_default(changedir, tmpdir):
kas.kas(['checkout', 'test.yml']) 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): 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']) kas.kas(['checkout', 'test.yml'])
del os.environ['KAS_BUILD_DIR'] 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'))

View File

@ -46,7 +46,7 @@ def test_layers_default(dokas):
for line in f: for line in f:
if '{}/kas '.format(LAYERBASE) in line: if '{}/kas '.format(LAYERBASE) in line:
match += 1 match += 1
assert(match == 1) assert match == 1
def test_layers_include(dokas): def test_layers_include(dokas):
@ -55,17 +55,17 @@ def test_layers_include(dokas):
for line in f: for line in f:
if '{}/kas1/meta-'.format(LAYERBASE) in line: if '{}/kas1/meta-'.format(LAYERBASE) in line:
match += 1 match += 1
assert(match == 2) assert match == 2
def test_layers_exclude(dokas): def test_layers_exclude(dokas):
with open('build/conf/bblayers.conf', 'r') as f: with open('build/conf/bblayers.conf', 'r') as f:
for line in 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): def test_layers_strip_dot(dokas):
with open('build/conf/bblayers.conf', 'r') as f: with open('build/conf/bblayers.conf', 'r') as f:
lines = f.readlines() lines = f.readlines()
assert(any('{}/kas3 '.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)) assert any('{}/kas3/meta-bar'.format(LAYERBASE) in x for x in lines)