-
-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit resolves a critical failure with respect to @beartype's handling of PEP 563 (i.e., `from __future__ import annotations`) in concert with the PEP 484-compliant `typing.NoReturn` type hint, resolving issue #282 kindly submitted by prehistoric aquatic dinosaur MIT horror @dcharatan (David Charatan) as well as a variety of related ML horror shows throughout the PyTorch ecosystem. Thanks so much to @justinchuby and the fearless PyTorch crew for patiently tolerating @beartype's pawful growing pains. Dare we pretend that @beartype 0.16.0 never happened, Microsoft? We dare. (*Salient tent in a salacious salad!?*)
- Loading branch information
Showing
10 changed files
with
145 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
# --------------------( LICENSE )-------------------- | ||
# Copyright (c) 2014-2023 Beartype authors. | ||
# See "LICENSE" for further details. | ||
|
||
''' | ||
Project-wide **PyTorch** integration tests. | ||
This submodule functionally tests the :mod:`beartype` package against the | ||
third-party PyTorch package. | ||
''' | ||
|
||
# ....................{ IMPORTS }.................... | ||
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
# WARNING: To raise human-readable test errors, avoid importing from | ||
# package-specific submodules at module scope. | ||
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
from beartype_test._util.mark.pytskip import skip_unless_package | ||
|
||
# ....................{ TESTS }.................... | ||
@skip_unless_package('torch') | ||
def test_torch() -> None: | ||
''' | ||
Functional test validating that the :mod:`beartype` package raises *no* | ||
unexpected exceptions when imported by the third-party PyTorch package. | ||
To do so, this test externally imports the :mod:`torch` package against a | ||
minimal-length Python snippet exercising all known edge cases. | ||
''' | ||
|
||
# ....................{ IMPORTS }.................... | ||
# Defer test-specific imports. | ||
from beartype._util.py.utilpyinterpreter import ( | ||
get_interpreter_command_words) | ||
from beartype_test._util.command.pytcmdrun import run_command_forward_output | ||
|
||
# ....................{ LOCAL }.................... | ||
# Tuple of all arguments to be passed to the active Python interpreter rerun | ||
# as an external command. | ||
_PYTHON_ARGS = get_interpreter_command_words() + ('-c', 'import torch',) | ||
|
||
# ....................{ PASS }.................... | ||
# Run this command, raising an exception on subprocess failure while | ||
# forwarding all standard output and error output by this subprocess to the | ||
# standard output and error file handles of the active Python process. | ||
run_command_forward_output(command_words=_PYTHON_ARGS) |