Add smoke tests for the training examples (#585) · vinthony/diffusers@4f1c989 · GitHub
Skip to content

Commit 4f1c989

Browse files
authored
Add smoke tests for the training examples (huggingface#585)
* Add smoke tests for the training examples * upd * use a dummy dataset * mark as slow * cleanup * Update test cases * naming
1 parent 3fc8ef7 commit 4f1c989

3 files changed

Lines changed: 221 additions & 1 deletion

File tree

‎.github/workflows/push_tests.yml‎

Lines changed: 52 additions & 1 deletion

‎examples/conftest.py‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copyright 2022 The HuggingFace Team. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# tests directory-specific settings - this file is run automatically
16+
# by pytest before any tests are run
17+
18+
import sys
19+
import warnings
20+
from os.path import abspath, dirname, join
21+
22+
23+
# allow having multiple repository checkouts and not needing to remember to rerun
24+
# 'pip install -e .[dev]' when switching between checkouts and running tests.
25+
git_repo_path = abspath(join(dirname(dirname(dirname(__file__))), "src"))
26+
sys.path.insert(1, git_repo_path)
27+
28+
29+
# silence FutureWarning warnings in tests since often we can't act on them until
30+
# they become normal warnings - i.e. the tests still need to test the current functionality
31+
warnings.simplefilter(action="ignore", category=FutureWarning)
32+
33+
34+
def pytest_addoption(parser):
35+
from diffusers.testing_utils import pytest_addoption_shared
36+
37+
pytest_addoption_shared(parser)
38+
39+
40+
def pytest_terminal_summary(terminalreporter):
41+
from diffusers.testing_utils import pytest_terminal_summary_main
42+
43+
make_reports = terminalreporter.config.getoption("--make-reports")
44+
if make_reports:
45+
pytest_terminal_summary_main(terminalreporter, id=make_reports)

‎examples/test_examples.py‎

Lines changed: 124 additions & 0 deletions

0 commit comments

Comments
 (0)