diff --git a/.github/workflows/base.yml b/.github/workflows/base.yml index 3a2164c..534b49d 100644 --- a/.github/workflows/base.yml +++ b/.github/workflows/base.yml @@ -23,10 +23,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 - name: Install python 3.9 - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5 with: python-version: 3.9 architecture: x64 @@ -57,7 +57,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 # General case - name: Install python ${{ matrix.nox_session.python }} for tests (not 3.5 not 3.14) @@ -99,7 +99,7 @@ jobs: cache-build: true - name: Install python 3.12 for nox - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5 with: python-version: 3.12 architecture: x64 @@ -118,7 +118,7 @@ jobs: # Share ./docs/reports so that they can be deployed with doc in next job - name: Share reports with other jobs if: runner.os == 'Linux' - uses: actions/upload-artifact@v4.3.1 + uses: actions/upload-artifact@v4 with: name: reports_dir path: ./docs/reports @@ -128,10 +128,10 @@ jobs: if: github.event_name == 'pull_request' steps: - name: Checkout - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 - name: Install python 3.9 for nox - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5 with: python-version: 3.9 architecture: x64 @@ -153,20 +153,20 @@ jobs: run: echo "$GITHUB_CONTEXT" - name: Checkout with no depth - uses: actions/checkout@v4.1.1 + uses: actions/checkout@v4 with: fetch-depth: 0 # so that gh-deploy works # persist-credentials: false # see https://github.com/orgs/community/discussions/25702 - name: Install python 3.9 for nox - uses: actions/setup-python@v5.1.0 + uses: actions/setup-python@v5 with: python-version: 3.9 architecture: x64 # 1) retrieve the reports generated previously - name: Retrieve reports - uses: actions/download-artifact@v4.1.4 + uses: actions/download-artifact@v4 with: name: reports_dir path: ./docs/reports @@ -198,7 +198,7 @@ jobs: EOF - name: \[not on TAG\] Publish coverage report if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads') - uses: codecov/codecov-action@v4.1.1 + uses: codecov/codecov-action@v4 with: files: ./docs/reports/coverage/coverage.xml - name: \[not on TAG\] Build wheel and sdist diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 7ccec7f..e3a55ee 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -12,13 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 + - uses: actions/checkout@v4 with: # [Required] Access token with `workflow` scope. token: ${{ secrets.WORKFLOW_SECRET }} - name: Run GitHub Actions Version Updater - uses: saadmk11/github-actions-version-updater@v0.8.1 + uses: saadmk11/github-actions-version-updater@v0.8 with: # [Required] Access token with `workflow` scope. token: ${{ secrets.WORKFLOW_SECRET }} diff --git a/docs/changelog.md b/docs/changelog.md index 18e0798..7fe3bb8 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -3,7 +3,8 @@ ### 1.16.0 - (in progress) new python versions scope - Removed official support for python versions `<3.9`. These versions will not run in CI anymore. - +- Fixed `RuntimeError` in tests when running on python 3.14. Added python 3.14 to CI. Fixes + [#112](https://github.com/smarie/python-makefun/issues/112) ### 1.15.6 - compatibility fix diff --git a/noxfile.py b/noxfile.py index 07da61f..3e58570 100644 --- a/noxfile.py +++ b/noxfile.py @@ -52,7 +52,7 @@ class Folders: ENVS = { - # PY314: {"coverage": False, "pkg_specs": {"pip": ">19"}}, + PY314: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY313: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY312: {"coverage": False, "pkg_specs": {"pip": ">19"}}, PY311: {"coverage": False, "pkg_specs": {"pip": ">19"}}, diff --git a/setup.cfg b/setup.cfg index 429824b..f33e42d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,13 +19,6 @@ classifiers = License :: OSI Approved :: BSD License Topic :: Software Development :: Libraries :: Python Modules Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.5 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 @@ -41,6 +34,7 @@ install_requires = funcsigs;python_version<'3.3' tests_require = pytest + pytest-asyncio # for some reason these pytest dependencies were not declared in old versions of pytest six;python_version<'3.6' attr;python_version<'3.6' diff --git a/tests/test_generators_coroutines.py b/tests/test_generators_coroutines.py index f9ec779..15f4d6c 100644 --- a/tests/test_generators_coroutines.py +++ b/tests/test_generators_coroutines.py @@ -76,7 +76,7 @@ def my_gencoroutine_handler(first_msg): @pytest.mark.skipif(sys.version_info < (3, 5), reason="native coroutines with async/await require python3.6 or higher") -def test_native_coroutine(): +async def test_native_coroutine(): """ Tests that we can use a native async coroutine as function_handler in `create_function`""" # define the handler that should be called @@ -92,13 +92,12 @@ def test_native_coroutine(): assert is_native_co(dynamic_fun) # verify that the new function is a native coroutine and behaves correctly - from asyncio import get_event_loop - out = get_event_loop().run_until_complete(dynamic_fun(0.1)) + out = await dynamic_fun(0.1) assert out == 0.1 @pytest.mark.skipif(sys.version_info < (3, 5), reason="native coroutines with async/await require python3.6 or higher") -def test_issue_96(): +async def test_issue_96(): """Same as `test_native_coroutine` but tests that we can use 'return' in the coroutine name""" # define the handler that should be called @@ -114,6 +113,5 @@ def test_issue_96(): assert is_native_co(dynamic_fun) # verify that the new function is a native coroutine and behaves correctly - from asyncio import get_event_loop - out = get_event_loop().run_until_complete(dynamic_fun(0.1)) + out = await dynamic_fun(0.1) assert out == 0.1 diff --git a/tests/test_issues.py b/tests/test_issues.py index ed32a9b..b2c5e49 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -228,7 +228,7 @@ def f(a): @pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python 3.6 or higher (async generator)") -def test_issue_77_async_generator_wraps(): +async def test_issue_77_async_generator_wraps(): import asyncio from ._test_py36 import make_async_generator, make_async_generator_wrapper @@ -238,11 +238,12 @@ def test_issue_77_async_generator_wraps(): assert inspect.isasyncgenfunction(f) assert inspect.isasyncgenfunction(wrapper) - assert asyncio.get_event_loop().run_until_complete(asyncio.ensure_future(wrapper(1).__anext__())) == 1 + out = await asyncio.ensure_future(wrapper(1).__anext__()) + assert out == 1 @pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python 3.6 or higher (async generator)") -def test_issue_77_async_generator_partial(): +async def test_issue_77_async_generator_partial(): import asyncio from ._test_py36 import make_async_generator @@ -252,7 +253,8 @@ def test_issue_77_async_generator_partial(): assert inspect.isasyncgenfunction(f) assert inspect.isasyncgenfunction(f_partial) - assert asyncio.get_event_loop().run_until_complete(asyncio.ensure_future(f_partial().__anext__())) == 1 + out = await asyncio.ensure_future(f_partial().__anext__()) + assert out == 1 @pytest.mark.skipif(sys.version_info < (3, 7, 6), reason="The __wrapped__ behavior in get_type_hints being tested was not added until python 3.7.6.")