Skip to content

BUG: Some tests using scripts: non-functional on windows #1152

Closed
@h-vetinari

Description

@h-vetinari

There are situations where the package_contents tests are not applicable (especially because file exclusion isn't implemented yet).

In conda-forge/zlib-feedstock#83, I currently have

     tests:
      - script:
        - if: unix
          then:
            - test ! -f ${PREFIX}/lib/libz.a
            - test ! -f ${PREFIX}/lib/libz${SHLIB_EXT}
            - test ! -f ${PREFIX}/include/zlib.h
          else:
            - if not exist %LIBRARY_BIN%\zlib.dll exit 1
            - if not exist %PREFIX%\zlib.dll exit 1

During the build (logs) on windows, we see that the file we're testing for is definitely there,

 │ │ Files in package:
 │ │   - Library/bin/zlib.dll
 │ │   - zlib.dll
 │ │   - info/[...]

but the test fails

 │ │ │ (base) %SRC_DIR%>if not exist D:\bld\bld\rattler-build_libzlib_1730506967\work\test\Library\bin\zlib.dll exit 1 
 │ │ │ × error Script failed with status 1

I understand that the positive tests can be formulated as

tests:
  - package_contents:
      files:

but what worries me far more is that anything under tests: scripts: produces false positives or negatives. If we can't trust that correctly specified, benign-looking tests are executed correctly (and doubly so if they're working under conda-build), we're blocked from migrating at scale.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions