summaryrefslogtreecommitdiffstats
path: root/meta-python/recipes-devtools/python/python3-yappi
diff options
context:
space:
mode:
Diffstat (limited to 'meta-python/recipes-devtools/python/python3-yappi')
-rw-r--r--meta-python/recipes-devtools/python/python3-yappi/0001-test_functionality-convert-line-endings-to-Unix.patch (renamed from meta-python/recipes-devtools/python/python3-yappi/0001-Fix-imports-for-ptests.patch)120
-rw-r--r--meta-python/recipes-devtools/python/python3-yappi/0002-Fix-import-of-tests.utils-to-enable-pytest.patch101
-rw-r--r--meta-python/recipes-devtools/python/python3-yappi/0002-add-3.11-to-the-setup.patch26
-rw-r--r--meta-python/recipes-devtools/python/python3-yappi/run-ptest2
4 files changed, 137 insertions, 112 deletions
diff --git a/meta-python/recipes-devtools/python/python3-yappi/0001-Fix-imports-for-ptests.patch b/meta-python/recipes-devtools/python/python3-yappi/0001-test_functionality-convert-line-endings-to-Unix.patch
index 476db4b7d0..70d4607c29 100644
--- a/meta-python/recipes-devtools/python/python3-yappi/0001-Fix-imports-for-ptests.patch
+++ b/meta-python/recipes-devtools/python/python3-yappi/0001-test_functionality-convert-line-endings-to-Unix.patch
@@ -1,44 +1,23 @@
1From 0dedc1c573ddc4e87475eb03c64555cd54a72e92 Mon Sep 17 00:00:00 2001 1From 0136ca731cba8b056b3f2ff0e7df3953b94f1e87 Mon Sep 17 00:00:00 2001
2From: Trevor Gamblin <trevor.gamblin@windriver.com> 2From: Tim Orling <tim.orling@konsulko.com>
3Date: Mon, 7 Jun 2021 09:40:20 -0400 3Date: Sun, 24 Dec 2023 09:41:57 -0800
4Subject: [PATCH] Fix imports for tests 4Subject: [PATCH 1/2] test_functionality: convert line endings to Unix
5 5
6Signed-off-by: Trevor Gamblin <trevor.gamblin@windriver.com> 6Convert the Windows line endings with dos2unix to be like the
7--- 7other files in tests/*
8Upstream-Status: Pending 8
9Upstream-Status: Submitted [https://github.com/sumerc/yappi/pull/164]
9 10
10 tests/test_asyncio.py | 2 +- 11Signed-off-by: Tim Orling <tim.orling@konsulko.com>
11 tests/test_asyncio_context_vars.py | 2 +- 12---
12 tests/test_functionality.py | 2 +- 13 tests/test_functionality.py | 3822 +++++++++++++++++------------------
13 tests/test_hooks.py | 2 +- 14 1 file changed, 1911 insertions(+), 1911 deletions(-)
14 tests/test_tags.py | 2 +-
15 5 files changed, 6 insertions(+), 6 deletions(-)
16 15
17--- a/tests/test_asyncio.py 16diff --git a/tests/test_functionality.py b/tests/test_functionality.py
18+++ b/tests/test_asyncio.py 17index 0e99c47..38bbe67 100644
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')
39--- a/tests/test_functionality.py 18--- a/tests/test_functionality.py
40+++ b/tests/test_functionality.py 19+++ b/tests/test_functionality.py
41@@ -1,1916 +1,1916 @@ 20@@ -1,1911 +1,1911 @@
42-import os 21-import os
43-import sys 22-import sys
44-import time 23-import time
@@ -47,7 +26,7 @@ Upstream-Status: Pending
47-import yappi 26-import yappi
48-import _yappi 27-import _yappi
49-import utils 28-import utils
50-import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6 29-import multiprocessing
51-import subprocess 30-import subprocess
52- 31-
53-_counter = 0 32-_counter = 0
@@ -318,10 +297,10 @@ Upstream-Status: Pending
318- def test_profile_decorator(self): 297- def test_profile_decorator(self):
319- 298-
320- def aggregate(func, stats): 299- def aggregate(func, stats):
321- fname = "tests/%s.profile" % (func.__name__) 300- fname = f"tests/{func.__name__}.profile"
322- try: 301- try:
323- stats.add(fname) 302- stats.add(fname)
324- except IOError: 303- except OSError:
325- pass 304- pass
326- stats.save(fname) 305- stats.save(fname)
327- raise Exception("messing around") 306- raise Exception("messing around")
@@ -1232,7 +1211,7 @@ Upstream-Status: Pending
1232- # TODO: I put dummy() to fix below, remove the comments after a while. 1211- # TODO: I put dummy() to fix below, remove the comments after a while.
1233- self.assertTrue( # FIX: I see this fails sometimes? 1212- self.assertTrue( # FIX: I see this fails sometimes?
1234- tsm is not None, 1213- 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))}")
1236- 1215-
1237- def test_ctx_stats(self): 1216- def test_ctx_stats(self):
1238- from threading import Thread 1217- from threading import Thread
@@ -1312,7 +1291,7 @@ Upstream-Status: Pending
1312- # TODO: I put dummy() to fix below, remove the comments after a while. 1291- # TODO: I put dummy() to fix below, remove the comments after a while.
1313- self.assertTrue( # FIX: I see this fails sometimes 1292- self.assertTrue( # FIX: I see this fails sometimes
1314- tsmain is not None, 1293- 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))}")
1316- self.assertTrue(1.0 > tst2.ttot >= 0.5) 1295- self.assertTrue(1.0 > tst2.ttot >= 0.5)
1317- self.assertTrue(1.0 > tst1.ttot >= 0.5) 1296- self.assertTrue(1.0 > tst1.ttot >= 0.5)
1318- 1297-
@@ -1369,7 +1348,7 @@ Upstream-Status: Pending
1369- ts = [] 1348- ts = []
1370- for i in (0.01, 0.05, 0.1): 1349- for i in (0.01, 0.05, 0.1):
1371- t = threading.Thread(target=burn_cpu, args=(i, )) 1350- t = threading.Thread(target=burn_cpu, args=(i, ))
1372- t.name = "burn_cpu-%s" % str(i) 1351- t.name = f"burn_cpu-{str(i)}"
1373- t.start() 1352- t.start()
1374- ts.append(t) 1353- ts.append(t)
1375- for t in ts: 1354- for t in ts:
@@ -1396,10 +1375,7 @@ Upstream-Status: Pending
1396- def test_producer_consumer_with_queues(self): 1375- def test_producer_consumer_with_queues(self):
1397- # we currently just stress yappi, no functionality test is done here. 1376- # we currently just stress yappi, no functionality test is done here.
1398- yappi.start() 1377- yappi.start()
1399- if utils.is_py3x(): 1378- from queue import Queue
1400- from queue import Queue
1401- else:
1402- from Queue import Queue
1403- from threading import Thread 1379- from threading import Thread
1404- WORKER_THREAD_COUNT = 50 1380- WORKER_THREAD_COUNT = 50
1405- WORK_ITEM_COUNT = 2000 1381- WORK_ITEM_COUNT = 2000
@@ -1458,7 +1434,6 @@ Upstream-Status: Pending
1458- fsh = utils.find_stat_by_name(stats, "handler") 1434- fsh = utils.find_stat_by_name(stats, "handler")
1459- self.assertTrue(fsh is not None) 1435- self.assertTrue(fsh is not None)
1460- 1436-
1461- @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
1462- def test_concurrent_futures(self): 1437- def test_concurrent_futures(self):
1463- yappi.start() 1438- yappi.start()
1464- from concurrent.futures import ThreadPoolExecutor 1439- from concurrent.futures import ThreadPoolExecutor
@@ -1468,7 +1443,6 @@ Upstream-Status: Pending
1468- time.sleep(1.0) 1443- time.sleep(1.0)
1469- yappi.stop() 1444- yappi.stop()
1470- 1445-
1471- @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
1472- def test_barrier(self): 1446- def test_barrier(self):
1473- yappi.start() 1447- yappi.start()
1474- b = threading.Barrier(2, timeout=1) 1448- b = threading.Barrier(2, timeout=1)
@@ -1962,8 +1936,8 @@ Upstream-Status: Pending
1962+import unittest 1936+import unittest
1963+import yappi 1937+import yappi
1964+import _yappi 1938+import _yappi
1965+import tests.utils as utils 1939+import utils
1966+import multiprocessing # added to fix http://bugs.python.org/issue15881 for > Py2.6 1940+import multiprocessing
1967+import subprocess 1941+import subprocess
1968+ 1942+
1969+_counter = 0 1943+_counter = 0
@@ -2234,10 +2208,10 @@ Upstream-Status: Pending
2234+ def test_profile_decorator(self): 2208+ def test_profile_decorator(self):
2235+ 2209+
2236+ def aggregate(func, stats): 2210+ def aggregate(func, stats):
2237+ fname = "tests/%s.profile" % (func.__name__) 2211+ fname = f"tests/{func.__name__}.profile"
2238+ try: 2212+ try:
2239+ stats.add(fname) 2213+ stats.add(fname)
2240+ except IOError: 2214+ except OSError:
2241+ pass 2215+ pass
2242+ stats.save(fname) 2216+ stats.save(fname)
2243+ raise Exception("messing around") 2217+ raise Exception("messing around")
@@ -3007,8 +2981,8 @@ Upstream-Status: Pending
3007+ 2981+
3008+ def test_issue_32(self): 2982+ def test_issue_32(self):
3009+ ''' 2983+ '''
3010+ Start yappi from different thread and we get Internal Error(15) as 2984+ Start yappi from different thread and we get Internal Error(15) as
3011+ the current_ctx_id() called while enumerating the threads in start() 2985+ the current_ctx_id() called while enumerating the threads in start()
3012+ and as it does not swap to the enumerated ThreadState* the THreadState_GetDict() 2986+ and as it does not swap to the enumerated ThreadState* the THreadState_GetDict()
3013+ returns wrong object and thus sets an invalid id for the _ctx structure. 2987+ returns wrong object and thus sets an invalid id for the _ctx structure.
3014+ 2988+
@@ -3148,7 +3122,7 @@ Upstream-Status: Pending
3148+ # TODO: I put dummy() to fix below, remove the comments after a while. 3122+ # TODO: I put dummy() to fix below, remove the comments after a while.
3149+ self.assertTrue( # FIX: I see this fails sometimes? 3123+ self.assertTrue( # FIX: I see this fails sometimes?
3150+ tsm is not None, 3124+ 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))}")
3152+ 3126+
3153+ def test_ctx_stats(self): 3127+ def test_ctx_stats(self):
3154+ from threading import Thread 3128+ from threading import Thread
@@ -3228,7 +3202,7 @@ Upstream-Status: Pending
3228+ # TODO: I put dummy() to fix below, remove the comments after a while. 3202+ # TODO: I put dummy() to fix below, remove the comments after a while.
3229+ self.assertTrue( # FIX: I see this fails sometimes 3203+ self.assertTrue( # FIX: I see this fails sometimes
3230+ tsmain is not None, 3204+ 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))}")
3232+ self.assertTrue(1.0 > tst2.ttot >= 0.5) 3206+ self.assertTrue(1.0 > tst2.ttot >= 0.5)
3233+ self.assertTrue(1.0 > tst1.ttot >= 0.5) 3207+ self.assertTrue(1.0 > tst1.ttot >= 0.5)
3234+ 3208+
@@ -3285,7 +3259,7 @@ Upstream-Status: Pending
3285+ ts = [] 3259+ ts = []
3286+ for i in (0.01, 0.05, 0.1): 3260+ for i in (0.01, 0.05, 0.1):
3287+ t = threading.Thread(target=burn_cpu, args=(i, )) 3261+ t = threading.Thread(target=burn_cpu, args=(i, ))
3288+ t.name = "burn_cpu-%s" % str(i) 3262+ t.name = f"burn_cpu-{str(i)}"
3289+ t.start() 3263+ t.start()
3290+ ts.append(t) 3264+ ts.append(t)
3291+ for t in ts: 3265+ for t in ts:
@@ -3312,10 +3286,7 @@ Upstream-Status: Pending
3312+ def test_producer_consumer_with_queues(self): 3286+ def test_producer_consumer_with_queues(self):
3313+ # we currently just stress yappi, no functionality test is done here. 3287+ # we currently just stress yappi, no functionality test is done here.
3314+ yappi.start() 3288+ yappi.start()
3315+ if utils.is_py3x(): 3289+ from queue import Queue
3316+ from queue import Queue
3317+ else:
3318+ from Queue import Queue
3319+ from threading import Thread 3290+ from threading import Thread
3320+ WORKER_THREAD_COUNT = 50 3291+ WORKER_THREAD_COUNT = 50
3321+ WORK_ITEM_COUNT = 2000 3292+ WORK_ITEM_COUNT = 2000
@@ -3374,7 +3345,6 @@ Upstream-Status: Pending
3374+ fsh = utils.find_stat_by_name(stats, "handler") 3345+ fsh = utils.find_stat_by_name(stats, "handler")
3375+ self.assertTrue(fsh is not None) 3346+ self.assertTrue(fsh is not None)
3376+ 3347+
3377+ @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
3378+ def test_concurrent_futures(self): 3348+ def test_concurrent_futures(self):
3379+ yappi.start() 3349+ yappi.start()
3380+ from concurrent.futures import ThreadPoolExecutor 3350+ from concurrent.futures import ThreadPoolExecutor
@@ -3384,7 +3354,6 @@ Upstream-Status: Pending
3384+ time.sleep(1.0) 3354+ time.sleep(1.0)
3385+ yappi.stop() 3355+ yappi.stop()
3386+ 3356+
3387+ @unittest.skipIf(not sys.version_info >= (3, 2), "requires Python 3.2")
3388+ def test_barrier(self): 3357+ def test_barrier(self):
3389+ yappi.start() 3358+ yappi.start()
3390+ b = threading.Barrier(2, timeout=1) 3359+ b = threading.Barrier(2, timeout=1)
@@ -3871,25 +3840,6 @@ Upstream-Status: Pending
3871+ # import sys;sys.argv = ['', 'BasicUsage.test_run_as_script'] 3840+ # import sys;sys.argv = ['', 'BasicUsage.test_run_as_script']
3872+ # import sys;sys.argv = ['', 'MultithreadedScenarios.test_subsequent_profile'] 3841+ # import sys;sys.argv = ['', 'MultithreadedScenarios.test_subsequent_profile']
3873+ unittest.main() 3842+ unittest.main()
3874--- a/tests/test_hooks.py 3843--
3875+++ b/tests/test_hooks.py 38442.34.1
3876@@ -5,7 +5,7 @@ import unittest 3845
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):
diff --git a/meta-python/recipes-devtools/python/python3-yappi/0002-Fix-import-of-tests.utils-to-enable-pytest.patch b/meta-python/recipes-devtools/python/python3-yappi/0002-Fix-import-of-tests.utils-to-enable-pytest.patch
new file mode 100644
index 0000000000..96dd024125
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-yappi/0002-Fix-import-of-tests.utils-to-enable-pytest.patch
@@ -0,0 +1,101 @@
1From 28eac38566327091221aabbc164ea8e433c66e7e Mon Sep 17 00:00:00 2001
2From: Tim Orling <tim.orling@konsulko.com>
3Date: Sun, 24 Dec 2023 09:27:50 -0800
4Subject: [PATCH 2/2] Fix import of tests.utils to enable pytest
5
6Running the test cases with pytest leads to importlib errors
7because the "utils" module cannot be found.
8
9Upstream-Status: Submitted [https://github.com/sumerc/yappi/pull/164]
10
11Signed-off-by: Tim Orling <tim.orling@konsulko.com>
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
21diff --git a/tests/test_asyncio.py b/tests/test_asyncio.py
22index 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):
34diff --git a/tests/test_asyncio_context_vars.py b/tests/test_asyncio_context_vars.py
35index 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')
47diff --git a/tests/test_functionality.py b/tests/test_functionality.py
48index 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
60diff --git a/tests/test_gevent.py b/tests/test_gevent.py
61index 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
73diff --git a/tests/test_hooks.py b/tests/test_hooks.py
74index 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():
86diff --git a/tests/test_tags.py b/tests/test_tags.py
87index 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--
1002.34.1
101
diff --git a/meta-python/recipes-devtools/python/python3-yappi/0002-add-3.11-to-the-setup.patch b/meta-python/recipes-devtools/python/python3-yappi/0002-add-3.11-to-the-setup.patch
deleted file mode 100644
index d40bd2b7cc..0000000000
--- a/meta-python/recipes-devtools/python/python3-yappi/0002-add-3.11-to-the-setup.patch
+++ /dev/null
@@ -1,26 +0,0 @@
1From 38afdacf526410f970afc58e147c7377c6c7112c Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?S=C3=BCmer=20Cip?= <sumer.cip@platform.sh>
3Date: Fri, 25 Nov 2022 15:58:03 +0300
4Subject: [PATCH 2/2] add 3.11 to the setup
5
6---
7Upstream-Status: Pending
8
9 setup.py | 1 +
10 1 file changed, 1 insertion(+)
11
12diff --git a/setup.py b/setup.py
13index d006787..96e2a66 100644
14--- a/setup.py
15+++ b/setup.py
16@@ -56,6 +56,7 @@ CLASSIFIERS = [
17 'Programming Language :: Python :: 3.8',
18 'Programming Language :: Python :: 3.9',
19 'Programming Language :: Python :: 3.10',
20+ 'Programming Language :: Python :: 3.11',
21 'Programming Language :: Python :: Implementation :: CPython',
22 'Operating System :: OS Independent',
23 'Topic :: Software Development :: Libraries',
24--
252.30.2
26
diff --git a/meta-python/recipes-devtools/python/python3-yappi/run-ptest b/meta-python/recipes-devtools/python/python3-yappi/run-ptest
index 3385d68939..8d2017d39c 100644
--- a/meta-python/recipes-devtools/python/python3-yappi/run-ptest
+++ b/meta-python/recipes-devtools/python/python3-yappi/run-ptest
@@ -1,3 +1,3 @@
1#!/bin/sh 1#!/bin/sh
2 2
3pytest -o log_cli=true -o log_cli_level=INFO | sed -e 's/\[...%\]//g'| sed -e 's/PASSED/PASS/g'| sed -e 's/FAILED/FAIL/g'|sed -e 's/SKIPED/SKIP/g'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS"){printf "%s: %s\n", $NF, $0}else{print}}'| awk '{if ($NF=="PASS" || $NF=="FAIL" || $NF=="SKIP" || $NF=="XFAIL" || $NF=="XPASS") {$NF="";print $0}else{print}}' 3pytest --automake