Add python-3.7 tests#1818
Conversation
fad2eb7 to
91464f1
Compare
| from copy import deepcopy | ||
| from types import ModuleType | ||
| from typing import Any, Callable, Dict, List, Optional, Tuple | ||
| from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Tuple |
| validated_data = client_response.get_validated_data() | ||
| assert client_response.is_valid() is True | ||
| assert validated_data["Host"] == "headers.jsontest.com" | ||
| @pytest.mark.asyncio |
There was a problem hiding this comment.
The diff here is refactoring from deleting TestRequest and moving the tests out and using respx_mock , no other changes beyond that.
It's easier to use the respx_mock fixture when the tests are not in a unittest class.
There was a problem hiding this comment.
Looks much more beautiful, good job!
| orbs: | ||
| codecov: codecov/codecov@3.2.2 | ||
| node: circleci/node@5.0.2 | ||
| browser-tools: circleci/browser-tools@1.3.0 |
There was a problem hiding this comment.
This is how you install the chrome driver on the new images
There was a problem hiding this comment.
Do we need chrome and chrome driver?
| else | ||
| echo "Creating requirements under test/requirements.txt using requirements.in. Please run this script from unix or wsl!" | ||
| echo "Creating requirements under test/requirements.txt using requirements.in. Please run this script from unix or wsl in a python3.7 env!" | ||
| python -c "import sys; assert sys.version_info < (3, 8) and sys.version_info >= (3, 7), 'Run from python 3.7!'" || exit 1 |
There was a problem hiding this comment.
Modified this script to exit if it's not running in a python 3.7 environment so that devs do not create a requirements file that cannot be installed in python 3.7.
My thinking is that dependencies that work on python 3.7 also work on python 3.9. It's only as of recent that packages stopped supporting 3.7 so if anything we're just pinned to a slightly older version.
If for whatever reason this assumption does not hold in the future, we can add separate files for separate python versions but I don't think we need that now.
There was a problem hiding this comment.
EDITED version: We shouldn't restrict developers to use Python 3.7. Instead, I think it's fine to let them run scripts/create_test_requirements.sh in whichever version of Python they are using, but if they push a change to the requirements that isn't 3.7-compatible, they'll know because 3.7 CI tests will fail.
There was a problem hiding this comment.
Spoke with @abidlabs about this off line and instead we'll let this script run in any python version.
If devs push deps versions that are not compatible in python 3.7 they will know because the ci will fail.
| import gradio as gr | ||
|
|
||
|
|
||
| class TestDocumentatino(unittest.TestCase): |
There was a problem hiding this comment.
Noticed a typo:
| class TestDocumentatino(unittest.TestCase): | |
| class TestDocumentation(unittest.TestCase): |
There was a problem hiding this comment.
Lol good eye!
|
Thanks for addressing my suggestions @freddyaboulton! LGTM |
omerXfaruq
left a comment
There was a problem hiding this comment.
LGTM! Just wondering about whether if we need chrome and chrome driver?
|
We needed chrome driver for selenium tests in the past, we probably don't need them anymore. |
|
Thank you @farukozderim ! Went ahead and deleted the chrome driver install! |

Description
Some of our test dependencies do not support python 3.7 in their latest releases 😞
I saw two ways to solve this:
test/requirements.txtbe valid python 3.7 and 3.9 dependencies.I opted for the first approach. I think that will be simpler to maintain going forward.
Fixes: #1806
Fixes #1807
Fixes #1814
Checklist: