Skip to content

Commit e819d00

Browse files
committed
python3-yappi: upgrade 1.4.0 -> 1.6.0; fix ptests
* Switch to the python_setuptools_build_meta PEP-517 backend * Refactor and submit 0001-Fix-imports-for-ptests.patch - split out the Windows -> Unix line endings conversion - sumerc/yappi#164 * Drop 0002-add-3.11-to-the-setup.patch; upstream added 3.11 and 3.12 * Drop install of yappi.py in ptest; use site-packages as intended * Drop complex run-ptest and simply run 'pytest --automake' * Move out of "problems" group to "slow" group in ptest-packageslists-meta-python.inc - can now build meta-python-image-ptest-python3-yappi - tests take about 45 seconds https://github.com/sumerc/yappi/blob/1.6.0/CHANGELOG 1.6.0 (2023-12-07) - Drop support 2.7-3.5 and clean backward compatible code (pull/152) - Add Python 3.12 wheels 1.5.1 (2023-12-06) - Add support for Python 3.12 - Fix child callgrind functions disappear Signed-off-by: Tim Orling <[email protected]>
1 parent 4887e48 commit e819d00

7 files changed

+175
-149
lines changed

meta-python/conf/include/ptest-packagelists-meta-python.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ PTESTS_FAST_META_PYTHON = "\
5656

5757
PTESTS_SLOW_META_PYTHON = "\
5858
python3-lz4 \
59+
python3-yappi \
5960
"
6061

6162
PTESTS_PROBLEMS_META_PYTHON ="\
@@ -84,6 +85,5 @@ PTESTS_PROBLEMS_META_PYTHON ="\
8485
python3-whoosh \
8586
python3-ujson \
8687
python3-xlrd \
87-
python3-yappi \
8888
python3-yarl \
8989
"

meta-python/recipes-devtools/python/python3-yappi/0001-Fix-imports-for-ptests.patch renamed to meta-python/recipes-devtools/python/python3-yappi/0001-test_functionality-convert-line-endings-to-Unix.patch

Lines changed: 35 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,23 @@
1-
From 0dedc1c573ddc4e87475eb03c64555cd54a72e92 Mon Sep 17 00:00:00 2001
2-
From: Trevor Gamblin <trevor.gamblin@windriver.com>
3-
Date: Mon, 7 Jun 2021 09:40:20 -0400
4-
Subject: [PATCH] Fix imports for tests
1+
From 0136ca731cba8b056b3f2ff0e7df3953b94f1e87 Mon Sep 17 00:00:00 2001
2+
From: Tim Orling <tim.orling@konsulko.com>
3+
Date: Sun, 24 Dec 2023 09:41:57 -0800
4+
Subject: [PATCH 1/2] test_functionality: convert line endings to Unix
55

6-
Signed-off-by: Trevor Gamblin <[email protected]>
7-
---
8-
Upstream-Status: Pending
6+
Convert the Windows line endings with dos2unix to be like the
7+
other files in tests/*
8+
9+
Upstream-Status: Submitted [https://github.com/sumerc/yappi/pull/164]
910

10-
tests/test_asyncio.py | 2 +-
11-
tests/test_asyncio_context_vars.py | 2 +-
12-
tests/test_functionality.py | 2 +-
13-
tests/test_hooks.py | 2 +-
14-
tests/test_tags.py | 2 +-
15-
5 files changed, 6 insertions(+), 6 deletions(-)
11+
Signed-off-by: Tim Orling <[email protected]>
12+
---
13+
tests/test_functionality.py | 3822 +++++++++++++++++------------------
14+
1 file changed, 1911 insertions(+), 1911 deletions(-)
1615

17-
--- a/tests/test_asyncio.py
18-
+++ b/tests/test_asyncio.py
19-
@@ -2,7 +2,7 @@ import unittest
20-
import yappi
21-
import asyncio
22-
import threading
23-
-from utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
24-
+from .utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
25-
26-
27-
async def async_sleep(sec):
28-
--- a/tests/test_asyncio_context_vars.py
29-
+++ b/tests/test_asyncio_context_vars.py
30-
@@ -5,7 +5,7 @@ import contextvars
31-
import functools
32-
import time
33-
import os
34-
-import utils
35-
+import tests.utils as utils
36-
import yappi
37-
38-
async_context_id = contextvars.ContextVar('async_context_id')
16+
diff --git a/tests/test_functionality.py b/tests/test_functionality.py
17+
index 0e99c47..38bbe67 100644
3918
--- a/tests/test_functionality.py
4019
+++ b/tests/test_functionality.py
41-
@@ -1,1916 +1,1916 @@
20+
@@ -1,1911 +1,1911 @@
4221
-import os
4322
-import sys
4423
-import time
@@ -47,7 +26,7 @@ Upstream-Status: Pending
4726
-import yappi
4827
-import _yappi
4928
-import utils
50-
-import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
29+
-import multiprocessing
5130
-import subprocess
5231
-
5332
-_counter = 0
@@ -318,10 +297,10 @@ Upstream-Status: Pending
318297
- def test_profile_decorator(self):
319298
-
320299
- def aggregate(func, stats):
321-
- fname = "tests/%s.profile" % (func.__name__)
300+
- fname = f"tests/{func.__name__}.profile"
322301
- try:
323302
- stats.add(fname)
324-
- except IOError:
303+
- except OSError:
325304
- pass
326305
- stats.save(fname)
327306
- raise Exception("messing around")
@@ -1232,7 +1211,7 @@ Upstream-Status: Pending
12321211
- # TODO: I put dummy() to fix below, remove the comments after a while.
12331212
- self.assertTrue( # FIX: I see this fails sometimes?
12341213
- tsm is not None,
1235-
- 'Could not find "_MainThread". Found: %s' % (', '.join(utils.get_stat_names(tstats))))
1214+
- f"Could not find \"_MainThread\". Found: {', '.join(utils.get_stat_names(tstats))}")
12361215
-
12371216
- def test_ctx_stats(self):
12381217
- from threading import Thread
@@ -1312,7 +1291,7 @@ Upstream-Status: Pending
13121291
- # TODO: I put dummy() to fix below, remove the comments after a while.
13131292
- self.assertTrue( # FIX: I see this fails sometimes
13141293
- tsmain is not None,
1315-
- 'Could not find "_MainThread". Found: %s' % (', '.join(utils.get_stat_names(stats))))
1294+
- f"Could not find \"_MainThread\". Found: {', '.join(utils.get_stat_names(stats))}")
13161295
- self.assertTrue(1.0 > tst2.ttot >= 0.5)
13171296
- self.assertTrue(1.0 > tst1.ttot >= 0.5)
13181297
-
@@ -1369,7 +1348,7 @@ Upstream-Status: Pending
13691348
- ts = []
13701349
- for i in (0.01, 0.05, 0.1):
13711350
- t = threading.Thread(target=burn_cpu, args=(i, ))
1372-
- t.name = "burn_cpu-%s" % str(i)
1351+
- t.name = f"burn_cpu-{str(i)}"
13731352
- t.start()
13741353
- ts.append(t)
13751354
- for t in ts:
@@ -1396,10 +1375,7 @@ Upstream-Status: Pending
13961375
- def test_producer_consumer_with_queues(self):
13971376
- # we currently just stress yappi, no functionality test is done here.
13981377
- yappi.start()
1399-
- if utils.is_py3x():
1400-
- from queue import Queue
1401-
- else:
1402-
- from Queue import Queue
1378+
- from queue import Queue
14031379
- from threading import Thread
14041380
- WORKER_THREAD_COUNT = 50
14051381
- WORK_ITEM_COUNT = 2000
@@ -1458,7 +1434,6 @@ Upstream-Status: Pending
14581434
- fsh = utils.find_stat_by_name(stats, "handler")
14591435
- self.assertTrue(fsh is not None)
14601436
-
1461-
- @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
14621437
- def test_concurrent_futures(self):
14631438
- yappi.start()
14641439
- from concurrent.futures import ThreadPoolExecutor
@@ -1468,7 +1443,6 @@ Upstream-Status: Pending
14681443
- time.sleep(1.0)
14691444
- yappi.stop()
14701445
-
1471-
- @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
14721446
- def test_barrier(self):
14731447
- yappi.start()
14741448
- b = threading.Barrier(2, timeout=1)
@@ -1962,8 +1936,8 @@ Upstream-Status: Pending
19621936
+import unittest
19631937
+import yappi
19641938
+import _yappi
1965-
+import tests.utils as utils
1966-
+import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6
1939+
+import utils
1940+
+import multiprocessing
19671941
+import subprocess
19681942
+
19691943
+_counter = 0
@@ -2234,10 +2208,10 @@ Upstream-Status: Pending
22342208
+ def test_profile_decorator(self):
22352209
+
22362210
+ def aggregate(func, stats):
2237-
+ fname = "tests/%s.profile" % (func.__name__)
2211+
+ fname = f"tests/{func.__name__}.profile"
22382212
+ try:
22392213
+ stats.add(fname)
2240-
+ except IOError:
2214+
+ except OSError:
22412215
+ pass
22422216
+ stats.save(fname)
22432217
+ raise Exception("messing around")
@@ -3007,8 +2981,8 @@ Upstream-Status: Pending
30072981
+
30082982
+ def test_issue_32(self):
30092983
+ '''
3010-
+ Start yappi from different thread and we get Internal Error(15) as
3011-
+ the current_ctx_id() called while enumerating the threads in start()
2984+
+ Start yappi from different thread and we get Internal Error(15) as
2985+
+ the current_ctx_id() called while enumerating the threads in start()
30122986
+ and as it does not swap to the enumerated ThreadState* the THreadState_GetDict()
30132987
+ returns wrong object and thus sets an invalid id for the _ctx structure.
30142988
+
@@ -3148,7 +3122,7 @@ Upstream-Status: Pending
31483122
+ # TODO: I put dummy() to fix below, remove the comments after a while.
31493123
+ self.assertTrue( # FIX: I see this fails sometimes?
31503124
+ tsm is not None,
3151-
+ 'Could not find "_MainThread". Found: %s' % (', '.join(utils.get_stat_names(tstats))))
3125+
+ f"Could not find \"_MainThread\". Found: {', '.join(utils.get_stat_names(tstats))}")
31523126
+
31533127
+ def test_ctx_stats(self):
31543128
+ from threading import Thread
@@ -3228,7 +3202,7 @@ Upstream-Status: Pending
32283202
+ # TODO: I put dummy() to fix below, remove the comments after a while.
32293203
+ self.assertTrue( # FIX: I see this fails sometimes
32303204
+ tsmain is not None,
3231-
+ 'Could not find "_MainThread". Found: %s' % (', '.join(utils.get_stat_names(stats))))
3205+
+ f"Could not find \"_MainThread\". Found: {', '.join(utils.get_stat_names(stats))}")
32323206
+ self.assertTrue(1.0 > tst2.ttot >= 0.5)
32333207
+ self.assertTrue(1.0 > tst1.ttot >= 0.5)
32343208
+
@@ -3285,7 +3259,7 @@ Upstream-Status: Pending
32853259
+ ts = []
32863260
+ for i in (0.01, 0.05, 0.1):
32873261
+ t = threading.Thread(target=burn_cpu, args=(i, ))
3288-
+ t.name = "burn_cpu-%s" % str(i)
3262+
+ t.name = f"burn_cpu-{str(i)}"
32893263
+ t.start()
32903264
+ ts.append(t)
32913265
+ for t in ts:
@@ -3312,10 +3286,7 @@ Upstream-Status: Pending
33123286
+ def test_producer_consumer_with_queues(self):
33133287
+ # we currently just stress yappi, no functionality test is done here.
33143288
+ yappi.start()
3315-
+ if utils.is_py3x():
3316-
+ from queue import Queue
3317-
+ else:
3318-
+ from Queue import Queue
3289+
+ from queue import Queue
33193290
+ from threading import Thread
33203291
+ WORKER_THREAD_COUNT = 50
33213292
+ WORK_ITEM_COUNT = 2000
@@ -3374,7 +3345,6 @@ Upstream-Status: Pending
33743345
+ fsh = utils.find_stat_by_name(stats, "handler")
33753346
+ self.assertTrue(fsh is not None)
33763347
+
3377-
+ @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
33783348
+ def test_concurrent_futures(self):
33793349
+ yappi.start()
33803350
+ from concurrent.futures import ThreadPoolExecutor
@@ -3384,7 +3354,6 @@ Upstream-Status: Pending
33843354
+ time.sleep(1.0)
33853355
+ yappi.stop()
33863356
+
3387-
+ @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
33883357
+ def test_barrier(self):
33893358
+ yappi.start()
33903359
+ b = threading.Barrier(2, timeout=1)
@@ -3871,25 +3840,6 @@ Upstream-Status: Pending
38713840
+ # import sys;sys.argv = ['', 'BasicUsage.test_run_as_script']
38723841
+ # import sys;sys.argv = ['', 'MultithreadedScenarios.test_subsequent_profile']
38733842
+ unittest.main()
3874-
--- a/tests/test_hooks.py
3875-
+++ b/tests/test_hooks.py
3876-
@@ -5,7 +5,7 @@ import unittest
3877-
import time
3878-
3879-
import yappi
3880-
-import utils
3881-
+import tests.utils as utils
3882-
3883-
3884-
def a():
3885-
--- a/tests/test_tags.py
3886-
+++ b/tests/test_tags.py
3887-
@@ -2,7 +2,7 @@ import unittest
3888-
import yappi
3889-
import threading
3890-
import time
3891-
-from utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
3892-
+from .utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
3893-
3894-
3895-
class MultiThreadTests(YappiUnitTestCase):
3843+
--
3844+
2.34.1
3845+
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
From 28eac38566327091221aabbc164ea8e433c66e7e Mon Sep 17 00:00:00 2001
2+
From: Tim Orling <[email protected]>
3+
Date: Sun, 24 Dec 2023 09:27:50 -0800
4+
Subject: [PATCH 2/2] Fix import of tests.utils to enable pytest
5+
6+
Running the test cases with pytest leads to importlib errors
7+
because the "utils" module cannot be found.
8+
9+
Upstream-Status: Submitted [https://github.com/sumerc/yappi/pull/164]
10+
11+
Signed-off-by: Tim Orling <[email protected]>
12+
---
13+
tests/test_asyncio.py | 2 +-
14+
tests/test_asyncio_context_vars.py | 2 +-
15+
tests/test_functionality.py | 2 +-
16+
tests/test_gevent.py | 2 +-
17+
tests/test_hooks.py | 2 +-
18+
tests/test_tags.py | 2 +-
19+
6 files changed, 6 insertions(+), 6 deletions(-)
20+
21+
diff --git a/tests/test_asyncio.py b/tests/test_asyncio.py
22+
index 8e9e631..bb36f4a 100644
23+
--- a/tests/test_asyncio.py
24+
+++ b/tests/test_asyncio.py
25+
@@ -2,7 +2,7 @@ import unittest
26+
import yappi
27+
import asyncio
28+
import threading
29+
-from utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
30+
+from tests.utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
31+
32+
33+
async def async_sleep(sec):
34+
diff --git a/tests/test_asyncio_context_vars.py b/tests/test_asyncio_context_vars.py
35+
index 5bd750c..9a253c0 100644
36+
--- a/tests/test_asyncio_context_vars.py
37+
+++ b/tests/test_asyncio_context_vars.py
38+
@@ -5,7 +5,7 @@ import contextvars
39+
import functools
40+
import time
41+
import os
42+
-import utils
43+
+import tests.utils as utils
44+
import yappi
45+
46+
async_context_id = contextvars.ContextVar('async_context_id')
47+
diff --git a/tests/test_functionality.py b/tests/test_functionality.py
48+
index 38bbe67..8098f17 100644
49+
--- a/tests/test_functionality.py
50+
+++ b/tests/test_functionality.py
51+
@@ -5,7 +5,7 @@ import threading
52+
import unittest
53+
import yappi
54+
import _yappi
55+
-import utils
56+
+import tests.utils as utils
57+
import multiprocessing
58+
import subprocess
59+
60+
diff --git a/tests/test_gevent.py b/tests/test_gevent.py
61+
index ed9e6ae..502af5f 100644
62+
--- a/tests/test_gevent.py
63+
+++ b/tests/test_gevent.py
64+
@@ -2,7 +2,7 @@ import unittest
65+
import _yappi
66+
import yappi
67+
import threading
68+
-from utils import (
69+
+from tests.utils import (
70+
YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io, burn_io_gevent
71+
)
72+
73+
diff --git a/tests/test_hooks.py b/tests/test_hooks.py
74+
index 297c643..8c387fc 100644
75+
--- a/tests/test_hooks.py
76+
+++ b/tests/test_hooks.py
77+
@@ -5,7 +5,7 @@ import unittest
78+
import time
79+
80+
import yappi
81+
-import utils
82+
+import tests.utils as utils
83+
84+
85+
def a():
86+
diff --git a/tests/test_tags.py b/tests/test_tags.py
87+
index b0b531d..b5a4016 100644
88+
--- a/tests/test_tags.py
89+
+++ b/tests/test_tags.py
90+
@@ -2,7 +2,7 @@ import unittest
91+
import yappi
92+
import threading
93+
import time
94+
-from utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
95+
+from tests.utils import YappiUnitTestCase, find_stat_by_name, burn_cpu, burn_io
96+
97+
98+
class MultiThreadTests(YappiUnitTestCase):
99+
--
100+
2.34.1
101+

meta-python/recipes-devtools/python/python3-yappi/0002-add-3.11-to-the-setup.patch

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)