gradio/test/conftest.py
Freddy Boulton e2dc87aa2b
Reset components to original state by setting value to None (#2044)
* Fix + test

* Fix test

* Rename demo file

* Delete unused demo

* Refactor into independent demos

* change (#2059)

* Remove chatbot

Co-authored-by: aliabid94 <aabid94@gmail.com>
2022-08-22 16:04:59 -04:00

35 lines
749 B
Python

import inspect
import pathlib
import pytest
import gradio as gr
def pytest_configure(config):
config.addinivalue_line(
"markers", "flaky: mark test as flaky. Failure will not cause te"
)
@pytest.fixture
def test_file_dir():
return pathlib.Path(pathlib.Path(__file__).parent, "test_files")
@pytest.fixture
def io_components():
classes_to_check = gr.components.IOComponent.__subclasses__()
subclasses = []
while classes_to_check:
subclass = classes_to_check.pop()
children = subclass.__subclasses__()
if children:
classes_to_check.extend(children)
if "value" in inspect.signature(subclass).parameters:
subclasses.append(subclass)
return subclasses