rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

Test scripts expressions are wrong evaluated

Open nichmor opened this issue 1 year ago • 1 comments

Having following in recipe.yaml:

tests:
  - requirements:
      run:
        - bzip2
    script:
      - if: unix
        then: 
          - test -f ${PREFIX}/fonts/Inconsolata-Regular.ttf
          - test -f ${PREFIX}/fonts/Inconsolata-Bold.ttf

will throw an error on windows: help: expected field ``script`` to be a list of commands until you add - echo 'hello'.

I think we need treat if:then as a list in this case or treat it as an empty list

nichmor avatar Jul 04 '24 15:07 nichmor

I agree that this could be fixed. There is a workaround though, and that would be to put the whole test in a if-construct, e.g.:

tests:
  - if: unix
    then:
      requirements:
        run:
          - bzip2
      script:
        - test -f ${PREFIX}/fonts/Inconsolata-Regular.ttf
        - test -f ${PREFIX}/fonts/Inconsolata-Bold.ttf

This also has the benefit that rattler-build would not create a test environment with bzip2 installed, and save some time on Windows.

wolfv avatar Oct 10 '24 12:10 wolfv