예제 #1
0
def test_lint_pin():
    run_lint(
        func=lint_functions._pin('CONDA_ZLIB', 'zlib'),
        should_pass=[
        '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            source:
              patches:
                - zlib_1.patch
        ''',
        '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              build:
                - zlib {{CONDA_ZLIB}}*
              run:
                - zlib {{CONDA_ZLIB}}*
        ''',
        '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              build:
                - zlib  # build-only requirements are obviously statically linked, hence no pinning needed
              run:
                - libgcc
        '''],
        should_fail=[
        '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'

            requirements:
              build:
                - zlib
              run:
                - zlib {{CONDA_ZLIB}}*
        ''',
        '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              build:
                - zlib {{CONDA_ZLIB}}*
              run:
                - zlib
        '''],
    )
예제 #2
0
def test_lint_pin():
    run_lint(
        func=lint_functions._pin('CONDA_ZLIB', 'zlib'),
        should_pass=[
            '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            source:
              patches:
                - zlib_1.patch
        ''', '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              build:
                - zlib {{CONDA_ZLIB}}*
              run:
                - zlib {{CONDA_ZLIB}}*
        ''', '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              build:
                - zlib  # build-only requirements are obviously statically linked, hence no pinning needed
              run:
                - libgcc
        ''', '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              run:
                - zlib  # run-only requirement doesn't need pinning; build is not influenced by it
        '''
        ],
        should_fail=[
            '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'

            requirements:
              build:
                - zlib
              run:
                - zlib {{CONDA_ZLIB}}*
        ''', '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'

            requirements:
              build:
                - zlib

              run:  # ^-- DO NOT remove the preceding line; it's part of the test case!
                - zlib
        ''', '''
        a:
          meta.yaml: |
            package:
              name: a
              version: '0.1'
            requirements:
              build:
                - zlib {{CONDA_ZLIB}}*
              run:
                - zlib
        '''
        ],
    )