Last active
March 29, 2024 22:38
-
-
Save roguh/eae6f03861dc9fc5b737b69b334a1737 to your computer and use it in GitHub Desktop.
Revisions
-
roguh revised this gist
Feb 22, 2024 . 2 changed files with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,7 @@ # This demonstrates using tox to test different Python versions and different library versions on select Python versions. # TODO: use asdf, pyenv, Dockerfile to install many py versions # Dependencies: aiohttp # Dev dependencies: pytest pytest-asyncio pytest-cov tox tox-pyenv [tox] @@ -8,13 +10,14 @@ envlist = # 3.7 is EOL and 3.8 only has 1 more year of security updates # Test 3.8 with an old version of dependencies py38 py38-oldaiohttp py39 py310 py311 # The latest Python version. # Test it with an old version of dependencies py311-oldaiohttp py311-olderaiohttp # The future :) py312 @@ -34,6 +37,7 @@ deps: # https://security.snyk.io/package/pip/aiohttp py39-oldaiohttp: aiohttp<3.9 py311-oldaiohttp: aiohttp<3.9 py311-olderaiohttp: aiohttp<3.8 # Run unit tests with pytest. # Pytest can also run unit tests that only use the builtin unittest module. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ async def test_aiohttp_version(): assert isinstance(aiohttp.__version__, str) if sys.version_info <= (3,8) or sys.version_info >= (3, 11): assert aiohttp.__version__ in ["3.9.3", "3.8.6", "3.7.4.post0"] else: assert aiohttp.__version__ == "3.9.3" or aiohttp.__version__.startswith("4.") -
roguh revised this gist
Feb 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,8 @@ envlist = # 3.7 is EOL and 3.8 only has 1 more year of security updates # Test 3.8 with an old version of dependencies py38 py39 py39-oldaiohttp py310 py311 # The latest Python version. -
roguh revised this gist
Feb 15, 2024 . 2 changed files with 50 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,40 @@ # This demonstrates using tox to test different Python versions and different library versions on select Python versions. # Dependencies: aiohttp # Dev dependencies: pytest pytest-asyncio pytest-cov tox tox-pyenv [tox] envlist = # The oldest Python version we support # 3.7 is EOL and 3.8 only has 1 more year of security updates # Test 3.8 with an old version of dependencies py38 py38-oldaiohttp py39 py310 py311 # The latest Python version. # Test it with an old version of dependencies py311-oldaiohttp # The future :) py312 [testenv] # Example here: https://stackoverflow.com/questions/57024579/tox-ini-environment-with-multiple-dependencies # 'deps' can also point to any number of requirements.txt or pyproject.toml files. # Here, we list all dependencies without using other files for the sake of simplicity. deps: # Install the latest version of aiohttp for all Python versions, with 2 exceptions. aiohttp tox-pyenv pytest pytest-asyncio pytest-cov # For the two Python versions where we'll support old libraries, install the old dependencies. # Old aiohttp versions have several CVEs, especially <=3.8.6 # https://security.snyk.io/package/pip/aiohttp py39-oldaiohttp: aiohttp<3.9 py311-oldaiohttp: aiohttp<3.9 # Run unit tests with pytest. # Pytest can also run unit tests that only use the builtin unittest module. commands = pytest --cov-report term --cov-report html --cov=. --capture=no --durations=0 --durations-min=0.01 --log-cli-level=CRITICAL {posargs} tox_example.py This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,18 @@ import sys import aiohttp import pytest @pytest.mark.asyncio async def test_aiohttp_version(): assert isinstance(aiohttp.__version__, str) if sys.version_info <= (3,8) or sys.version_info >= (3, 11): assert aiohttp.__version__ in ["3.9.3", "3.8.6"] else: assert aiohttp.__version__ == "3.9.3" or aiohttp.__version__.startswith("4.") def main(): print("AIOHTTP version is", aiohttp.__version__) if __name__ == "__main__": main() -
roguh created this gist
Feb 15, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ [tox] envlist = py37,py38,py39 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ import aiohttp def test_aiohttp_version(): assert isinstance(aiohttp.__version__, str) def main(): print("AIOHTTP version is", aiohttp.__version__) if __name__ == "__main__": main()