gradio/test
cswamy 77c900311e
Fixes issue 5781: Enables specifying a caching directory for Examples (#6803)
* issue 5781 first commit

* second commit

* unnecessary str removed

* backend formatted

* Update gradio/helpers.py

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* Update guides/02_building-interfaces/03_more-on-examples.md

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>

* tests added

* add changeset

* format

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2023-12-18 17:07:38 -08:00
..
golden
test_files Rotate Images to Upright Position in preprocess (#6676) 2023-12-07 13:16:48 -05:00
tmp
__init__.py
conftest.py Version 4 development branch (#5498) 2023-10-31 04:46:02 +00:00
README.md Refactor component directories (#5074) 2023-08-03 23:01:18 +01:00
requirements.in switch from black to ruff formatter (#6543) 2023-12-06 15:16:32 -08:00
requirements.txt Fix flaky CI tests (again 😓 ) (#6780) 2023-12-14 12:40:36 -08:00
test_analytics.py Issue 5245: consolidate usage of requests and httpx (#6598) 2023-12-05 14:18:09 -08:00
test_api_info.py Version 4 development branch (#5498) 2023-10-31 04:46:02 +00:00
test_blocks.py Fix component update bug (#6368) 2023-11-10 12:26:07 -08:00
test_buttons.py Cause gr.ClearButton to reset the value of gr.State (#6680) 2023-12-06 17:35:19 -08:00
test_chat_interface.py Fixes issue 5781: Enables specifying a caching directory for Examples (#6803) 2023-12-18 17:07:38 -08:00
test_components.py Adjust rounding logic when precision is None in gr.Number() (#6829) 2023-12-18 23:42:19 +00:00
test_custom_component_compatibility.py Processes avatar_images for gr.Chatbot and icon for gr.Button correctly, so that respective files are moved to cache (#6379) 2023-11-11 23:13:27 -08:00
test_events.py Add concurrency_limit to ChatInterface, add IDE support for concurrency_limit (#6653) 2023-12-04 17:19:53 -05:00
test_external.py Fixes issue 5781: Enables specifying a caching directory for Examples (#6803) 2023-12-18 17:07:38 -08:00
test_flagging.py fix: avoid unnecessary folders creation when flagging (#6245) 2023-11-02 12:28:38 -07:00
test_gradio_component_cli.py Fix flaky CI tests (again 😓 ) (#6780) 2023-12-14 12:40:36 -08:00
test_helpers.py Fixes issue 5781: Enables specifying a caching directory for Examples (#6803) 2023-12-18 17:07:38 -08:00
test_interfaces.py Issue 5245: consolidate usage of requests and httpx (#6598) 2023-12-05 14:18:09 -08:00
test_networking.py Version 4 development branch (#5498) 2023-10-31 04:46:02 +00:00
test_pipelines.py Version 4 development branch (#5498) 2023-10-31 04:46:02 +00:00
test_processing_utils.py Rotate Images to Upright Position in preprocess (#6676) 2023-12-07 13:16:48 -05:00
test_queueing.py Python client properly handles hearbeat and log messages. Also handles responses longer than 65k (#6693) 2023-12-13 17:47:06 -05:00
test_reload.py Fix SourceFileReloader to watch the module with a qualified name to avoid importing a module with the same name from a different path (#6497) 2023-11-20 13:54:26 -05:00
test_routes.py Mount on a FastAPI app with lifespan manager (#6759) 2023-12-12 16:40:03 -05:00
test_theme_sharing.py Hotfix: update huggingface_hub dependency version (#6704) 2023-12-07 15:07:23 -08:00
test_tunneling.py Version 4 development branch (#5498) 2023-10-31 04:46:02 +00:00
test_utils.py Prevent file traversals (#6833) 2023-12-18 14:30:22 -08:00

Backend Testing Guidelines

  • All the tests should test Backend functionalities. Frontend functionalities and e2e tests are done in Frontend.
  • Make use of pytest fixtures whenever it is possible. With fixtures, objects with high initialize durations are reused within tests, ex. a client session.
  • All testdata resides within _gradio/test_data and all test_files resides within test/test_files.
  • When doing network operations do not forget to make use of async to make tests faster.
  • Have clear class and function naming within the tests.
  • Short descriptions within test functions are great.
  • Library function docstrings is expected to contain an example, please add missing docstrings to the library while you are writing tests the related function.
  • Library docstring examples and descriptions are expected to align with tests, please fix divergent tests and library docstrings.