commit: 65f4a1918957621506106333f8b92140606963e4 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Fri Feb 10 12:33:00 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Fri Feb 10 13:02:48 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=65f4a191
dev-python/trimesh: Fix tests without pyinstrument Closes: https://bugs.gentoo.org/893806 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../files/trimesh-3.19.3-no-pyinstrument.patch | 36 ++++++++++++++++++++++ dev-python/trimesh/trimesh-3.19.3.ebuild | 4 +++ 2 files changed, 40 insertions(+) diff --git a/dev-python/trimesh/files/trimesh-3.19.3-no-pyinstrument.patch b/dev-python/trimesh/files/trimesh-3.19.3-no-pyinstrument.patch new file mode 100644 index 000000000000..76b1e552ce83 --- /dev/null +++ b/dev-python/trimesh/files/trimesh-3.19.3-no-pyinstrument.patch @@ -0,0 +1,36 @@ +From a4a0e4ea61d41d379c9b535af11cb5845c364970 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]> +Date: Fri, 10 Feb 2023 13:29:21 +0100 +Subject: [PATCH] fix dummy Profiler class to be a proper context manager + +The dummy `Profiler` class that is used whenever `pyinstrument` +is not available did not return a object in its `__enter__` method, +effectively breaking statements like: + + with g.Profiler() as P: + pass + print(P.output_text()) + +Make it return itself to fix that. This fixes 4 test failures for us. +--- + tests/generic.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/generic.py b/tests/generic.py +index d18f55c1..7c418e10 100644 +--- a/tests/generic.py ++++ b/tests/generic.py +@@ -49,8 +49,8 @@ try: + except BaseException: + # make a dummy profiler which does nothing + class Profiler(object): +- def __enter__(*args, **kwargs): +- pass ++ def __enter__(self, *args, **kwargs): ++ return self + + def __exit__(*args, **kwargs): + pass +-- +2.39.1 + diff --git a/dev-python/trimesh/trimesh-3.19.3.ebuild b/dev-python/trimesh/trimesh-3.19.3.ebuild index be6475bba950..74ea6d702396 100644 --- a/dev-python/trimesh/trimesh-3.19.3.ebuild +++ b/dev-python/trimesh/trimesh-3.19.3.ebuild @@ -52,6 +52,10 @@ BDEPEND=" distutils_enable_tests pytest +PATCHES=( + "${FILESDIR}"/trimesh-3.19.3-no-pyinstrument.patch +) + python_test() { epytest -n "$(makeopts_jobs)" }
