| 1 |
from pathlib import Path |
| 2 |
|
| 3 |
from conda_package_handling.validate import validate_converted_files_match_streaming |
| 4 |
|
| 5 |
from .test_api import data_dir, test_package_name, test_package_name_2 |
| 6 |
|
| 7 |
|
| 8 |
def test_validate_streaming(): |
| 9 |
assert validate_converted_files_match_streaming( |
| 10 |
Path(data_dir, test_package_name + ".conda"), |
| 11 |
Path(data_dir, test_package_name + ".tar.bz2"), |
| 12 |
strict=False, |
| 13 |
) == (Path(data_dir, test_package_name + ".conda"), [], []) |
| 14 |
|
| 15 |
# old converted files don't match uname, gname, mtime |
| 16 |
assert validate_converted_files_match_streaming( |
| 17 |
Path(data_dir, test_package_name + ".conda"), |
| 18 |
Path(data_dir, test_package_name + ".tar.bz2"), |
| 19 |
strict=True, |
| 20 |
) != (Path(data_dir, test_package_name + ".conda"), [], []) |
| 21 |
|
| 22 |
src, missing, mismatched = validate_converted_files_match_streaming( |
| 23 |
Path(data_dir, test_package_name_2 + ".tar.bz2"), |
| 24 |
Path(data_dir, test_package_name + ".conda"), |
| 25 |
strict=False, |
| 26 |
) |
| 27 |
|
| 28 |
assert src == Path(data_dir, test_package_name_2 + ".tar.bz2") |
| 29 |
# not that critical exactly what mismatches; we are comparing separate packages |
| 30 |
assert len(missing) == 47 |
| 31 |
assert mismatched == [ |
| 32 |
"info/hash_input.json", |
| 33 |
"info/files", |
| 34 |
"info/index.json", |
| 35 |
"info/paths.json", |
| 36 |
"info/about.json", |
| 37 |
"info/git", |
| 38 |
"info/recipe/meta.yaml", |
| 39 |
"info/recipe/conda_build_config.yaml", |
| 40 |
"info/recipe/meta.yaml.template", |
| 41 |
"info/hash_input.json", |
| 42 |
"info/index.json", |
| 43 |
"info/files", |
| 44 |
"info/about.json", |
| 45 |
"info/paths.json", |
| 46 |
"info/git", |
| 47 |
"info/recipe/meta.yaml.template", |
| 48 |
"info/recipe/conda_build_config.yaml", |
| 49 |
"info/recipe/meta.yaml", |
| 50 |
] |