1. 22 Mar, 2021 1 commit
  2. 20 Mar, 2021 1 commit
    • David Runge's avatar
      Improve Exception handling in convert · 6e821be6
      David Runge authored
      repo_management/convert.py:
      Change the docuemntation of `_desc_data_line_to_dicts()` to reflect,
      that it may raise ValueError under certain conditions.
      Change `_desc_data_to_model()` to try/except ValueError raised by
      `_desc_data_line_to_dicts()` and raise a
      `errors.REpomanagementValidationError` instead.
      
      tests/test_convert.py:
      Change tests expecting to raise `ValueError` to expect
      `errors.RepoManagementValidationError` instead.
      6e821be6
  3. 18 Mar, 2021 1 commit
    • David Runge's avatar
      Simplify convert and add class for template rendering · 9cff77d7
      David Runge authored
      repo_management/convert.py:
      Add the class `RepoDbFile` which is used to initialize a jinja
      environment and allows to render the 'desc.j2' and 'files.j2' templates.
      Add `_desc_data_line_to_dicts()` which allows for assigning the data
      from a line in a 'desc' file to be assigned to a dict, that corresponds
      to the line's designated data type.
      Simplify `_desc_data_to_model()` by making use of
      `_desc_data_line_to_dicts()`.
      Change `_desc_data_to_model()` by guarding against pydantic
      ValidationErrors and raising a RepoManagementValidationError instead.
      
      tests/test_convert.py:
      Add tests for `RepoDbFile`.
      9cff77d7
  4. 08 Mar, 2021 1 commit
    • David Runge's avatar
      Add conversion method for PackageDesc to OutputPackage · 45e96813
      David Runge authored
      repo_management/convert.py:
      Add private method `_transform_package_desc_to_output_package()` which
      can be used to construct a `models.OutputPackage` from a
      `models.PackageDesc` (and optionally a `models.PackageFiles`).
      The method drops attributes from a dict representation of the
      `models.PackageDesc` instance, that are not relevant for the
      `models.OutputPackage`.
      
      tests/test_convert.py:
      Add parametrized test for `_transform_package_desc_to_output_package()`.
      45e96813
  5. 07 Mar, 2021 1 commit
    • David Runge's avatar
      Add conversion of 'desc' files · 84e32326
      David Runge authored
      repo_management/defaults.py:
      Add the IntEnmu `FieldType` which tracks the required type for an
      attribute when converting from 'desc' or 'files' files to pydantic
      models.
      Extend the DESC_JSON and FILES_JSON globals by introducing a dict per
      key, that describes the name and the required type, when converting to
      pydantic models.
      
      repo_management/convert.py:
      Rename `_files_data_to_dict()` to `_read_files_data_to_model()` and
      return a pydantic model (`models.Files`) instead of a custom dict.
      Add `_desc_data_to_model()` which allows for conversion of a 'desc' data
      file (represented as io.StringIO) to a pydantic model
      (`models.PackageDesc`).
      
      tests/test_convert.py:
      Add another test for raising RuntimeError in
      `_read_files_data_to_model()`.
      Add a parametrized test for `_desc_data_to_model()`.
      84e32326
  6. 06 Mar, 2021 1 commit
    • David Runge's avatar
      Add initial tests for convert · d9105841
      David Runge authored
      tests/test_convert.py:
      Add initial tests for the convert module by adding a parametrized test
      for `_files_data_to_dict()`.
      d9105841