test_validate.py 1.7 KB

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