diff --git a/.azure/template-examples.yml b/.azure/template-examples.yml index 8b781c0cd8..1d7a6b0e75 100644 --- a/.azure/template-examples.yml +++ b/.azure/template-examples.yml @@ -57,7 +57,7 @@ jobs: - script: | pip list - python -m coverage run --source flash -m pytest tests/examples -vV --durations=30 + python -m coverage run --source flash -m pytest tests/examples -vV --timeout=300 --durations=30 displayName: 'Testing' - bash: | diff --git a/.github/workflows/ci-testing.yml b/.github/workflows/ci-testing.yml index 9dc5e1f5e1..968ed4425e 100644 --- a/.github/workflows/ci-testing.yml +++ b/.github/workflows/ci-testing.yml @@ -48,7 +48,7 @@ jobs: #- { os: 'ubuntu-20.04', python-version: 3.8, topic: 'serve', extra: [], requires: 'oldest' } # todo # Timeout: https://stackoverflow.com/a/59076067/4521646 - timeout-minutes: 50 + timeout-minutes: 70 env: FREEZE_REQUIREMENTS: 1 TORCH_URL: https://download.pytorch.org/whl/cpu/torch_stable.html @@ -151,7 +151,7 @@ jobs: tests/examples \ tests/template \ tests/${{ matrix.topic }} \ - -v # --reruns 3 --reruns-delay 2 + -v --timeout=300 --durations=50 # --reruns 3 --reruns-delay 2 - name: Save HF cache if: github.ref == 'refs/heads/master' diff --git a/requirements/test.txt b/requirements/test.txt index 1621bd6233..c22d82a3ab 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -6,3 +6,4 @@ pytest-doctestplus ==0.13.0 pytest-rerunfailures ==12.0 pytest-forked ==1.6.0 pytest-mock ==3.11.1 +pytest-timeout ==2.1.0 diff --git a/src/flash/core/utilities/imports.py b/src/flash/core/utilities/imports.py index cb118ddf86..181a89ca46 100644 --- a/src/flash/core/utilities/imports.py +++ b/src/flash/core/utilities/imports.py @@ -11,6 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import contextlib import functools import importlib import operator @@ -41,7 +42,8 @@ _MATPLOTLIB_AVAILABLE = module_available("matplotlib") _TRANSFORMERS_AVAILABLE = module_available("transformers") _PYSTICHE_AVAILABLE = module_available("pystiche") -_FIFTYONE_AVAILABLE = module_available("fiftyone") +with contextlib.suppress(ConnectionError): + _FIFTYONE_AVAILABLE = module_available("fiftyone") _FASTAPI_AVAILABLE = module_available("fastapi") _PYDANTIC_AVAILABLE = module_available("pydantic") _GRAPHVIZ_AVAILABLE = module_available("graphviz")