mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Stop parsing command line arguments every time common_utils is imported. (#156703)
Last PR in the series to re-submit https://github.com/pytorch/pytorch/pull/134592 as smaller PRs: https://github.com/pytorch/pytorch/pull/154612 https://github.com/pytorch/pytorch/pull/154628 https://github.com/pytorch/pytorch/pull/154715 https://github.com/pytorch/pytorch/pull/154716 https://github.com/pytorch/pytorch/pull/154725 https://github.com/pytorch/pytorch/pull/154728 Pull Request resolved: https://github.com/pytorch/pytorch/pull/156703 Approved by: https://github.com/clee2000
This commit is contained in:
committed by
PyTorch MergeBot
parent
c6329524d8
commit
ac7b4e7fe4
@ -21,6 +21,16 @@ from _pytest.terminal import _get_raw_skip_reason
|
||||
from pytest_shard_custom import pytest_addoptions as shard_addoptions, PytestShardPlugin
|
||||
|
||||
|
||||
try:
|
||||
from torch.testing._internal.common_utils import parse_cmd_line_args
|
||||
except ImportError:
|
||||
# Temporary workaround needed until parse_cmd_line_args makes it into a nightlye because
|
||||
# main / PR's tests are sometimes run against the previous day's nightly which won't
|
||||
# have this function.
|
||||
def parse_cmd_line_args():
|
||||
pass
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _pytest._code.code import ReprFileLocation
|
||||
|
||||
@ -83,6 +93,7 @@ def pytest_addoption(parser: Parser) -> None:
|
||||
|
||||
|
||||
def pytest_configure(config: Config) -> None:
|
||||
parse_cmd_line_args()
|
||||
xmlpath = config.option.xmlpath_reruns
|
||||
# Prevent opening xmllog on worker nodes (xdist).
|
||||
if xmlpath and not hasattr(config, "workerinput"):
|
||||
|
Reference in New Issue
Block a user