From fd38a0e1dd3dbe0de365e938ac3dca3bee4320dd Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 9 Feb 2022 15:30:26 +0100 Subject: change file path format From now on we'll be using format 'file/sha256/' instead of 'file/sha256-'. --- src/test/test_hydrilla_builder.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/test') diff --git a/src/test/test_hydrilla_builder.py b/src/test/test_hydrilla_builder.py index 0b6244f..f079d34 100644 --- a/src/test/test_hydrilla_builder.py +++ b/src/test/test_hydrilla_builder.py @@ -298,14 +298,13 @@ def test_build(tmpdir, prepare_source_example): set([path.name for path in dstdir.iterdir()]) # Verify files under 'file/' - file_dir = dstdir / 'file' + file_dir = dstdir / 'file' / 'sha256' for fn in settings.dist_filenames: - dist_file_path = file_dir / f'sha256-{settings.sha256_hashes[fn]}' + dist_file_path = file_dir / settings.sha256_hashes[fn] assert dist_file_path.is_file() - with open(dist_file_path, 'rb') as file_handle: - assert file_handle.read() == settings.contents[fn] + assert dist_file_path.read_bytes() == settings.contents[fn] sha256_hashes_set = set([settings.sha256_hashes[fn] for fn in settings.dist_filenames]) @@ -313,8 +312,7 @@ def test_build(tmpdir, prepare_source_example): spdx_report_sha256 = None for path in file_dir.iterdir(): - assert path.name.startswith('sha256-') - if path.name[7:] in sha256_hashes_set: + if path.name in sha256_hashes_set: continue assert spdx_report_sha256 is None and settings.report_spdx_included @@ -323,7 +321,7 @@ def test_build(tmpdir, prepare_source_example): spdx_contents = file_handle.read() spdx_report_sha256 = sha256(spdx_contents.encode()).digest().hex() - assert spdx_report_sha256 == path.name[7:] + assert spdx_report_sha256 == path.name for fn in settings.src_filenames: if not any([n in fn.lower() for n in ('license', 'reuse')]): -- cgit v1.2.3