From a93d81c3c950709714df7518003df198ad29e2ea Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 17 Feb 2025 08:32:38 -0600 Subject: [PATCH 1/2] test: allow for xz extension in flaky test --- tests/test_qt_qt_main.py | 59 +++++--- .../qtqtmain_octave_xz_after_meta.yaml | 142 ++++++++++++++++++ 2 files changed, 183 insertions(+), 18 deletions(-) create mode 100644 tests/test_yaml/qtqtmain_octave_xz_after_meta.yaml diff --git a/tests/test_qt_qt_main.py b/tests/test_qt_qt_main.py index 6616f1d28..d2fddf50e 100644 --- a/tests/test_qt_qt_main.py +++ b/tests/test_qt_qt_main.py @@ -19,7 +19,7 @@ [ ( "qtqtmain_octave_before_meta.yaml", - "qtqtmain_octave_after_meta.yaml", + ("qtqtmain_octave_after_meta.yaml", "qtqtmain_octave_xz_after_meta.yaml"), "7.1.0", ), ("qtqtmain_qgis_before_meta.yaml", "qtqtmain_qgis_after_meta.yaml", "3.18.3"), @@ -29,20 +29,43 @@ def test_qt_main(old_meta, new_meta, new_ver, tmpdir): with open(os.path.join(YAML_PATH, old_meta)) as fp: in_yaml = fp.read() - with open(os.path.join(YAML_PATH, new_meta)) as fp: - out_yaml = fp.read() - - run_test_migration( - m=VERSION_WITH_QTQTMAIN, - inp=in_yaml, - output=out_yaml, - kwargs={"new_version": new_ver}, - prb="Dependencies have been updated if changed", - mr_out={ - "migrator_name": Version.name, - "migrator_version": VERSION_WITH_QTQTMAIN.migrator_version, - "version": new_ver, - }, - tmpdir=tmpdir, - should_filter=False, - ) + if isinstance(new_meta, tuple): + out_yamls = [] + + for nm in new_meta: + with open(os.path.join(YAML_PATH, nm)) as fp: + out_yamls.append(fp.read()) + else: + with open(os.path.join(YAML_PATH, new_meta)) as fp: + out_yamls = [fp.read()] + + failed = [] + excepts = [] + for out_yaml in out_yamls: + try: + run_test_migration( + m=VERSION_WITH_QTQTMAIN, + inp=in_yaml, + output=out_yaml, + kwargs={"new_version": new_ver}, + prb="Dependencies have been updated if changed", + mr_out={ + "migrator_name": Version.name, + "migrator_version": VERSION_WITH_QTQTMAIN.migrator_version, + "version": new_ver, + }, + tmpdir=tmpdir, + should_filter=False, + ) + except Exception as e: + failed.append(True) + excepts.append(e) + else: + failed.append(False) + excepts.append(None) + + for e in excepts: + if e is not None: + raise e + + assert not all(failed) diff --git a/tests/test_yaml/qtqtmain_octave_xz_after_meta.yaml b/tests/test_yaml/qtqtmain_octave_xz_after_meta.yaml new file mode 100644 index 000000000..1a8ed703e --- /dev/null +++ b/tests/test_yaml/qtqtmain_octave_xz_after_meta.yaml @@ -0,0 +1,142 @@ +{% set version = "7.1.0" %} + +package: + name: octave + version: {{ version }} + +source: + url: https://ftp.gnu.org/gnu/octave/octave-{{ version }}.tar.xz + sha256: 3fd4615ebbab02c38c93ea6ba318756aedec38d98a5c732d409899e8b4356273 + +build: + number: 0 + skip: true # [win] + binary_has_prefix_files: # [unix] + - bin/octave-{{ version }} # [linux] + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - {{ compiler('fortran') }} + - make # [linux] + - automake + - sed + - perl + - ghostscript + - pkg-config # [linux] + - libgomp # [linux] + - llvm-openmp # [osx] + - bison + - gperf + - {{ cdt('mesa-libgl-devel') }} # [linux] + - {{ cdt('mesa-dri-drivers') }} # [linux] + - {{ cdt('libselinux') }} # [linux] + - {{ cdt('libxdamage') }} # [linux] + - {{ cdt('libxfixes') }} # [linux] + - {{ cdt('libxxf86vm') }} # [linux] + - {{ cdt('libxcb') }} # [linux] + - {{ cdt('expat') }} # [linux] + - {{ cdt('libxext') }} # [linux] + - {{ cdt('libxrender') }} # [linux] + - {{ cdt('libxt') }} # [linux] + - {{ cdt('libxft') }} # [linux] + - {{ cdt('libx11-devel') }} # [linux] + - {{ cdt('xorg-x11-proto-devel') }} # [linux] + host: + - libblas + - libcblas + - liblapack + - liblapacke + - libglu # [linux] + - pcre + - ghostscript + - sundials + - readline + - arpack + - curl + - libcurl + - fftw + - fontconfig + - freetype + - glpk + - gnuplot + - hdf5 + - suitesparse + - zlib + - bzip2 + - portaudio + - libsndfile + - qscintilla2 + - qhull + - graphicsmagick # [linux] + # Following gets linked at the end. + - icu + - ncurses + - xz + - libxml2 + - libpng + - glib + - qt-main + - openssl + - texinfo + - gl2ps + - fltk + - libiconv + - alsa-lib # [linux] + run: + - ghostscript + - texinfo + - gl2ps + - libglu # [linux] + - fltk + - pcre + - readline + - arpack + - curl + - sundials + - {{ pin_compatible("fftw", max_pin="x.x") }} + - fontconfig + - freetype + - glpk + - gnuplot + - hdf5 + - {{ pin_compatible("suitesparse", max_pin="x.x") }} + - zlib + - bzip2 + - {{ pin_compatible("portaudio") }} + - libsndfile + - {{ pin_compatible("qscintilla2", max_pin="x.x") }} + - qhull + - {{ pin_compatible("graphicsmagick") }} # [linux] + # Following gets linked at the end. + - icu + - ncurses + - xz + - libxml2 + - libpng + - glib + - qt-main + - openssl + +test: + requires: + - coreutils + commands: + - octave --version + - touch test_file.txt + - octave test_file.txt + +about: + home: https://www.gnu.org/software/octave/ + license: GPL-3.0-or-later + license_file: COPYING + doc_url: https://www.gnu.org/software/octave/doc/interpreter/ + summary: GNU Octave is a high-level language, primarily intended for numerical computations + +extra: + recipe-maintainers: + - isuruf + - ocefpaf + - izahn + - ngam From c2ad2cfb032b2e56176df45eb8471b926938b060 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 17 Feb 2025 08:48:02 -0600 Subject: [PATCH 2/2] fix: only raise if all fail --- tests/test_qt_qt_main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/test_qt_qt_main.py b/tests/test_qt_qt_main.py index d2fddf50e..fa0b7e8a8 100644 --- a/tests/test_qt_qt_main.py +++ b/tests/test_qt_qt_main.py @@ -64,8 +64,9 @@ def test_qt_main(old_meta, new_meta, new_ver, tmpdir): failed.append(False) excepts.append(None) - for e in excepts: - if e is not None: - raise e + if all(failed): + for e in excepts: + if e is not None: + raise e assert not all(failed)