Skip to content

Commit f926259

Browse files
authored
Merge pull request #379 from pythonprofilers/tests_back_to_cpython_3.5
test back to CPython 3.5
2 parents 2457246 + 0683885 commit f926259

File tree

3 files changed

+32
-7
lines changed

3 files changed

+32
-7
lines changed

.github/workflows/lint_python.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python: ['3.10']
19+
python:
20+
- major_dot_minor: '3.10'
21+
safety: false
2022
steps:
2123
- uses: actions/checkout@v3
2224
- uses: actions/setup-python@v4
@@ -29,7 +31,7 @@ jobs:
2931
#
3032
# CPython -> 3.9.0-alpha - 3.9.X
3133
# PyPy -> pypy-3.7
32-
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
34+
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.major_dot_minor), matrix.python.major_dot_minor))[startsWith(matrix.python.major_dot_minor, 'pypy')] }}
3335
architecture: x64
3436
- run: pip install --upgrade pip wheel
3537
- run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear
@@ -52,7 +54,21 @@ jobs:
5254
strategy:
5355
fail-fast: false
5456
matrix:
55-
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
57+
python:
58+
- major_dot_minor: '3.5'
59+
safety: false
60+
- major_dot_minor: '3.6'
61+
safety: false
62+
- major_dot_minor: '3.7'
63+
safety: false
64+
- major_dot_minor: '3.8'
65+
safety: true
66+
- major_dot_minor: '3.9'
67+
safety: true
68+
- major_dot_minor: '3.10'
69+
safety: true
70+
- major_dot_minor: '3.11'
71+
safety: true
5672
steps:
5773
- uses: actions/checkout@v3
5874
- uses: actions/setup-python@v4
@@ -65,12 +81,12 @@ jobs:
6581
#
6682
# CPython -> 3.9.0-alpha - 3.9.X
6783
# PyPy -> pypy-3.7
68-
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
84+
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python.major_dot_minor), matrix.python.major_dot_minor))[startsWith(matrix.python.major_dot_minor, 'pypy')] }}
6985
architecture: x64
7086
- run: pip install --upgrade pip wheel
7187
- run: pip install pytest safety
7288
- run: pip install --editable .
7389
- run: pip install numpy pylab-sdk
7490
- run: make test
75-
- if: matrix.python != '3.7'
91+
- if: matrix.python.safety
7692
run: safety check

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ classifiers =
2323
py_modules =
2424
memory_profiler
2525
mprof
26-
python_requires = >=3.4
26+
python_requires = >=3.5
2727
install_requires = psutil
2828

2929
[options.entry_points]

test/test_async.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import sys
23

34
from memory_profiler import profile
45

@@ -14,5 +15,13 @@ async def main():
1415
task = asyncio.create_task(my_func())
1516
res = await asyncio.gather(task)
1617

18+
async def main_legacy():
19+
future = asyncio.ensure_future(my_func())
20+
res = await asyncio.gather(future)
21+
1722
if __name__ == '__main__':
18-
asyncio.run(main()) # main loop
23+
if sys.version_info >= (3, 7):
24+
asyncio.run(main()) # main loop
25+
else:
26+
loop = asyncio.get_event_loop()
27+
loop.run_until_complete(main_legacy())

0 commit comments

Comments
 (0)