Skip to content

Commit

Permalink
Merge pull request #379 from pythonprofilers/tests_back_to_cpython_3.5
Browse files Browse the repository at this point in the history
test back to CPython 3.5
  • Loading branch information
altendky authored Nov 15, 2022
2 parents 2457246 + 0683885 commit f926259
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.10']
python:
- major_dot_minor: '3.10'
safety: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -29,7 +31,7 @@ jobs:
#
# CPython -> 3.9.0-alpha - 3.9.X
# PyPy -> pypy-3.7
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
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')] }}
architecture: x64
- run: pip install --upgrade pip wheel
- run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear
Expand All @@ -52,7 +54,21 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11']
python:
- major_dot_minor: '3.5'
safety: false
- major_dot_minor: '3.6'
safety: false
- major_dot_minor: '3.7'
safety: false
- major_dot_minor: '3.8'
safety: true
- major_dot_minor: '3.9'
safety: true
- major_dot_minor: '3.10'
safety: true
- major_dot_minor: '3.11'
safety: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
Expand All @@ -65,12 +81,12 @@ jobs:
#
# CPython -> 3.9.0-alpha - 3.9.X
# PyPy -> pypy-3.7
python-version: ${{ fromJSON(format('["{0}", "{1}"]', format('{0}.0-alpha - {0}.X', matrix.python), matrix.python))[startsWith(matrix.python, 'pypy')] }}
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')] }}
architecture: x64
- run: pip install --upgrade pip wheel
- run: pip install pytest safety
- run: pip install --editable .
- run: pip install numpy pylab-sdk
- run: make test
- if: matrix.python != '3.7'
- if: matrix.python.safety
run: safety check
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers =
py_modules =
memory_profiler
mprof
python_requires = >=3.4
python_requires = >=3.5
install_requires = psutil

[options.entry_points]
Expand Down
11 changes: 10 additions & 1 deletion test/test_async.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import sys

from memory_profiler import profile

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

async def main_legacy():
future = asyncio.ensure_future(my_func())
res = await asyncio.gather(future)

if __name__ == '__main__':
asyncio.run(main()) # main loop
if sys.version_info >= (3, 7):
asyncio.run(main()) # main loop
else:
loop = asyncio.get_event_loop()
loop.run_until_complete(main_legacy())

0 comments on commit f926259

Please sign in to comment.