# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           python 1.0
PortGroup           select 1.0

name                py-pytest
version             8.4.1
revision            0

categories-append   devel
platforms           {darwin any}
license             MIT
supported_archs     noarch

python.versions     27 35 36 37 38 39 310 311 312 313

maintainers         {stromnov @stromnov} openmaintainer

description         py.test: simple powerful testing with Python

long_description    The pytest framework makes it easy to write small tests, \
                    yet scales to support complex functional testing \
                    for applications and libraries.

homepage            https://pytest.org

checksums           rmd160  1b692680b0c2c6b26ced966f692036db6a5354fc \
                    sha256  7c67fd69174877359ed9371ec3af8a3d2b04741818c51e5e99cc1742251fa93c \
                    size    1517714

if {${name} ne ${subport}} {
    depends_build-append \
                        port:py${python.version}-setuptools_scm

    depends_lib-append  port:py${python.version}-setuptools \
                        port:py${python.version}-iniconfig \
                        port:py${python.version}-packaging \
                        port:py${python.version}-pluggy

    if {${python.version} < 38} {
        depends_lib-append \
                        port:py${python.version}-importlib-metadata
    }

    if {${python.version} < 311} {
        depends_lib-append \
                        port:py${python.version}-exceptiongroup \
                        port:py${python.version}-tomli
    }

    depends_run         port:pytest_select

    if {${python.version} eq 27} {
        version             4.6.3
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  5d88707bd2fc29ee675087b24461a9ca8cbe1ffb \
                            sha256  4a784f1d4f2ef198fe9b7aef793e9fa1a3b2f84e822d9b3a64a181293a572d45 \
                            size    949947

        depends_lib-append  port:py${python.version}-atomicwrites \
                            port:py${python.version}-six \
                            port:py${python.version}-funcsigs \
                            port:py${python.version}-more-itertools
    } elseif {${python.version} eq 35} {
        version             5.4.3
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  c846ffd08e49fe6742a97b6606aebcf4a2761f01 \
                            sha256  7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8 \
                            size    1022353
        depends_lib-append  port:py${python.version}-more-itertools
    } elseif {${python.version} eq 36} {
        version             7.0.1
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  530488f483b32848f0650ad490ce4e74e85263f8 \
                            sha256  e30905a0c131d3d94b89624a1cc5afec3e0ba2fbdb151867d8e0ebd49850f171 \
                            size    1249154
        # "py" was added for 6.0.0 then vendored in 7.2.0
        depends_lib-append  port:py${python.version}-py
    } elseif {${python.version} eq 37} {
        version             7.4.4
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  12d1be2172489516e510471f581f0391c1937dcb \
                            sha256  2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280 \
                            size    1357116
    } elseif {${python.version} eq 38} {
        version             8.3.5
        revision            0
        distname            ${python.rootname}-${version}
        checksums           rmd160  707dd941a3808989a6cf8b900cf7ba15f4b79404 \
                            sha256  f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845 \
                            size    1450891
    }

    if {${python.version} <= 35} {
        depends_lib-append  port:py${python.version}-wcwidth \
                            port:py${python.version}-pathlib2
        depends_lib-delete  port:py${python.version}-iniconfig \
                            port:py${python.version}-tomli
    }

    if {${python.version} <= 36} {
        # attrs was dropped in 7.3.0
        depends_lib-append  port:py${python.version}-attrs
        depends_lib-delete  port:py${python.version}-exceptiongroup
    }

    select.group        pytest
    select.file         ${filespath}/pytest${python.version}
    notes-append "
To make the Python ${python.branch} version of pytest the one that is run\
when you execute the commands without a version suffix, e.g. 'pytest', run:

sudo port select --set ${select.group} [file tail ${select.file}]
"

    livecheck.type      none
}
