diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 8181097eedb..a4fd47910c2 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -21,7 +21,7 @@ jobs: runs-on: ${{matrix.os}} strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14.0-beta.3'] os: [ubuntu-latest, windows-latest, macos-latest] fail-fast: False steps: @@ -36,7 +36,6 @@ jobs: - name: Install dependencies run: | python -W ignore -m pip install --upgrade pip - python -W ignore -m pip install -U pytest-cov python -W ignore -m pip install . --group tests - name: Test with pytest @@ -59,11 +58,10 @@ jobs: TO_TEST="test_no_passport.py or test_datetime.py or test_defaults.py or test_jobqueue.py or test_applicationbuilder.py or test_ratelimiter.py or test_updater.py or test_callbackdatacache.py or test_request.py" pytest -v --cov -k "${TO_TEST}" --junit-xml=.test_report_no_optionals_junit.xml opt_dep_status=$? - + # Test the rest export TEST_WITH_OPT_DEPS='true' - # need to manually install pytz here, because it's no longer in the optional reqs - pip install .[all] pytz + pip install .[all] # `-n auto --dist worksteal` uses pytest-xdist to run tests on multiple CPU # workers. Increasing number of workers has little effect on test duration, but it seems # to increase flakyness. diff --git a/changes/unreleased/4825.R7wiTzvN37KAV656s9kfnC.toml b/changes/unreleased/4825.R7wiTzvN37KAV656s9kfnC.toml new file mode 100644 index 00000000000..5f932e8254d --- /dev/null +++ b/changes/unreleased/4825.R7wiTzvN37KAV656s9kfnC.toml @@ -0,0 +1,5 @@ +other = "Add Python 3.14 Beta To Test Matrix. *Python 3.14 is not officially supported by PTB yet!*" +[[pull_requests]] +uid = "4825" +author_uid = "harshil21" +closes_threads = [] diff --git a/pyproject.toml b/pyproject.toml index 66589c25b0e..12c7d5df4d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] dependencies = [ "httpx >=0.27,<0.29", @@ -91,7 +92,7 @@ socks = [ ] webhooks = [ # tornado is rather stable, but let's not allow the next major release without prior testing - "tornado~=6.4", + "tornado~=6.5", ] [dependency-groups] @@ -99,7 +100,7 @@ tests = [ # required for building the wheels for releases "build", # For the test suite - "pytest==8.3.5", + "pytest==8.4.0", # needed because pytest doesn't come with native support for coroutines as tests "pytest-asyncio==0.21.2", # xdist runs tests in parallel @@ -111,6 +112,10 @@ tests = [ # For testing with timezones. Might not be needed on all systems, but to ensure that unit tests # run correctly on all systems, we include it here. "tzdata", + # We've deprecated support pytz, but we still need it for testing that it works with the library. + "pytz", + # Install coverage: + "pytest-cov" ] docs = [ "chango~=0.4.0; python_version >= '3.12'", @@ -123,6 +128,13 @@ docs = [ "sphinx-inline-tabs==2023.4.21", # Temporary. See #4387 "sphinx-build-compatibility @ git+https://github.com/readthedocs/sphinx-build-compatibility.git@58aabc5f207c6c2421f23d3578adc0b14af57047", + # For python 3.14 support, we need a version of pydantic-core >= 2.35.0, since it upgrades the + # rust toolchain, required for building the project. But there isn't a version of pydantic + # which allows that pydantic-core version yet, so we use the latest commit on the + # pydantic repository, which has the required version of pydantic-core. + # This should ideally be done in `chango`'s dependencies. We can remove this once a new pydantic + # version is released. + "pydantic @ git+https://github.com/pydantic/pydantic ; python_version >= '3.14'" ] all = ["pre-commit", { include-group = "tests" }, { include-group = "docs" }] diff --git a/tests/README.rst b/tests/README.rst index 822c90d35c7..77fbd7b1855 100644 --- a/tests/README.rst +++ b/tests/README.rst @@ -42,7 +42,7 @@ such that tests marked with ``@pytest.mark.xdist_group("name")`` are run on the .. code-block:: bash - $ pytest -n auto --dist=loadgroup + $ pytest -n auto --dist=worksteal This will result in a significant speedup, but may cause some tests to fail. If you want to run the failed tests in isolation, you can use the ``--lf`` flag: diff --git a/tests/ext/test_filters.py b/tests/ext/test_filters.py index ae125c98a40..6802db2a206 100644 --- a/tests/ext/test_filters.py +++ b/tests/ext/test_filters.py @@ -18,6 +18,7 @@ # along with this program. If not, see [http://www.gnu.org/licenses/]. import datetime as dtm import inspect +import platform import re import pytest @@ -711,7 +712,9 @@ def test_filters_document_type(self, update): assert not filters.Document.WAV.check_update(update) assert not filters.Document.AUDIO.check_update(update) - update.message.document.mime_type = "audio/x-wav" + update.message.document.mime_type = ( + "audio/x-wav" if int(platform.python_version_tuple()[1]) < 14 else "audio/vnd.wave" + ) assert filters.Document.WAV.check_update(update) assert filters.Document.AUDIO.check_update(update) assert not filters.Document.XML.check_update(update)