{% set tests_to_skip = "_not_a_real_test" %}
{% set version = "3.9.5" %}

package:
  name: aiohttp
  version: {{ version }}

source:
  - url: https://pypi.io/packages/source/a/aiohttp/aiohttp-{{ version }}.tar.gz
    sha256: edea7d15772ceeb29db4aff55e482d4bcfb6ae160ce144f2682de02f6d693551
  # download sources to have tests, which don't get installed;
  # installing from source is very painful, beware...
  - url: https://github.com/aio-libs/aiohttp/archive/refs/tags/v{{ version }}.tar.gz
    sha256: 4a1776997bd80f85442067440e32222eddc368f262c6550efdb10da7b9ee49ba
    folder: sources

build:
  number: 0
  skip: true  # [win and python_impl == "pypy"]
  script: {{ PYTHON }} -m pip install . -vv

requirements:
  build:
    - python                                 # [build_platform != target_platform]
    - cross-python_{{ target_platform }}     # [build_platform != target_platform]
    - cython                                 # [build_platform != target_platform]
    - {{ compiler('c') }}
  host:
    - python
    - pip
    - cython
  run:
    - python
    - aiosignal >=1.1.2
    - async-timeout >=4.0,<5.0  # [py<311]
    - attrs >=17.3.0
    - frozenlist >=1.1.1
    - multidict >=4.5,<7.0
    - yarl >=1.0,<2.0

test:
  requires:
    - pip
    - pytest <8
    - pytest-mock
    - brotli
    - brotlicffi
    - freezegun
    - gunicorn    # [unix]
    - proxy-py
    - re-assert
    - time-machine  # [python_impl == "cpython"]
    - trustme
  source_files:
    - sources/tests
    # used by a test
    - sources/README.rst
  imports:
    - aiohttp
  commands:
    - pip check
    # don't want the docker tests in the autobahn subfolder
    - rm -rf sources/tests/autobahn         # [unix]
    - rmdir /s /q sources\tests\autobahn    # [win]
    {% set tests_to_skip = "_not_a_real_test" %}
    # Fails since 270ae9cf6a9e6159b5e29a950deb6ff7600aebc5
    {% set tests_to_skip = tests_to_skip + " or test_http_response_parser_strict_obs_line_folding" %}
    {% set tests_to_skip = tests_to_skip + " or test_http_response_parser_bad_chunked_strict_c[pyloop]" %}
    {% set tests_to_skip = tests_to_skip + " or test_http_response_parser_bad_chunked_strict_py[pyloop]" %}
    {% set tests_to_skip = tests_to_skip + " or test_http_response_parser_strict_headers[c-parser-pyloop]" %}
    {% set tests_to_skip = tests_to_skip + " or test_tcp_connector_raise_connector_ssl_error[pyloop]" %}
    # flaky tests
    {% set tests_to_skip = tests_to_skip + " or test_heartbeat_no_pong[pyloop]" %}
    # test failing with python >=3.11
    {% set tests_to_skip = tests_to_skip + " or test_https_proxy_unsupported_tls_in_tls[pyloop-https]" %}   # [py>=311]
    # fails to open socket at desired IP/port
    {% set tests_to_skip = tests_to_skip + " or (test_web_server and test_handler_cancellation)" %}         # [linux]
    {% set tests_to_skip = tests_to_skip + " or (test_web_server and test_no_handler_cancellation)" %}      # [linux]
    {% set tests_to_skip = tests_to_skip + " or test_run_app_preexisting_inet6_socket[pyloop]" %}           # [linux]
    # emulation is too slow for expected speed
    {% set tests_to_skip = tests_to_skip + " or (test_imports and test_import_time)" %}                     # [aarch64 or ppc64le]
    # aio seems to hard-code expectation for cpython (i.e. not "pypy3.9" in SP_DIR path)
    {% set tests_to_skip = tests_to_skip + " or test_static_route_user_home" %}             # [python_impl == "pypy"]
    # not working with pypy (all platforms)
    {% set tests_to_skip = tests_to_skip + " or test_c_parser_loaded" %}                    # [python_impl == "pypy"]
    {% set tests_to_skip = tests_to_skip + " or test_invalid_character[pyloop]" %}          # [python_impl == "pypy"]
    {% set tests_to_skip = tests_to_skip + " or test_invalid_linebreak[pyloop]" %}          # [python_impl == "pypy"]
    # not working with pypy (win)
    {% set tests_to_skip = tests_to_skip + " or test_access_to_the_file_with_spaces" %}     # [python_impl == "pypy" and win]
    {% set tests_to_skip = tests_to_skip + " or test_follow_symlink[pyloop]" %}             # [python_impl == "pypy" and win]
    {% set tests_to_skip = tests_to_skip + " or test_static_file_huge[pyloop] " %}          # [python_impl == "pypy" and win]
    {% set tests_to_skip = tests_to_skip + " or test_subapp_reverse_static_url[pyloop]" %}  # [python_impl == "pypy" and win]
    {% set tests_to_skip = tests_to_skip + " or test_unsupported_upgrade[pyloop] " %}       # [python_impl == "pypy" and win]
    - pytest sources/tests/ -k "not ({{ tests_to_skip }})"

about:
  home: https://github.com/aio-libs/aiohttp
  license: MIT AND Apache-2.0
  license_file:
    - LICENSE.txt
    - vendor/llhttp/LICENSE-MIT
  license_family: Apache
  summary: Async http client/server framework (asyncio)

  doc_url: http://aiohttp.readthedocs.io/
  dev_url: https://github.com/aio-libs/aiohttp
  doc_source_url: https://github.com/aio-libs/aiohttp/tree/master/docs

extra:
  recipe-maintainers:
    - sodre
    - xhochy
    - ocefpaf
