Unverified Commit 5594eae6 authored by moto's avatar moto Committed by GitHub
Browse files

Run integration tests on CI (#1939)

parent 3c021f1f
name: Integration Test
on:
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ 3.8 ]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install packages
run: |
python -m pip install --quiet --upgrade pip
python -m pip install --quiet --pre torch -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html
python -m pip install --quiet pytest requests cmake ninja deep-phonemizer
git submodule update --init --recursive
python setup.py install
- name: Run integration test
run: |
cd test && pytest integration_tests -v --use-tmp-hub-dir
...@@ -55,3 +55,25 @@ def sample_speech(tmp_path, lang): ...@@ -55,3 +55,25 @@ def sample_speech(tmp_path, lang):
resp.raise_for_status() resp.raise_for_status()
file.write(resp.content) file.write(resp.content)
return path return path
def pytest_addoption(parser):
parser.addoption(
"--use-tmp-hub-dir",
action="store_true",
help=(
"When provided, tests will use temporary directory as Torch Hub directory. "
"Downloaded models will be deleted after each test."
)
)
@pytest.fixture(autouse=True)
def temp_hub_dir(tmpdir, pytestconfig):
if not pytestconfig.getoption('use_tmp_hub_dir'):
yield
else:
org_dir = torch.hub.get_dir()
torch.hub.set_dir(tmpdir)
yield
torch.hub.set_dir(org_dir)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment