mirror of
https://github.com/huggingface/transformers.git
synced 2025-07-04 21:30:07 +06:00

* make it possible to invoke testconf.py in both test suites without crashing on having the same option added * perl -pi -e 's|--make_reports|--make-reports|' to be consistent with other opts * add `pytest --make-reports` to all CIs (and artifacts) * fix
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
# tests directory-specific settings - this file is run automatically
|
|
# by pytest before any tests are run
|
|
|
|
import sys
|
|
import warnings
|
|
from os.path import abspath, dirname, join
|
|
|
|
|
|
# allow having multiple repository checkouts and not needing to remember to rerun
|
|
# 'pip install -e .[dev]' when switching between checkouts and running tests.
|
|
git_repo_path = abspath(join(dirname(dirname(__file__)), "src"))
|
|
sys.path.insert(1, git_repo_path)
|
|
|
|
# silence FutureWarning warnings in tests since often we can't act on them until
|
|
# they become normal warnings - i.e. the tests still need to test the current functionality
|
|
warnings.simplefilter(action="ignore", category=FutureWarning)
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
from transformers.testing_utils import pytest_addoption_shared
|
|
|
|
pytest_addoption_shared(parser)
|
|
|
|
|
|
def pytest_terminal_summary(terminalreporter):
|
|
from transformers.testing_utils import pytest_terminal_summary_main
|
|
|
|
make_reports = terminalreporter.config.getoption("--make-reports")
|
|
if make_reports:
|
|
pytest_terminal_summary_main(terminalreporter, id=make_reports)
|