Migrate tests to use BytesIO and temporary paths#181
Merged
Conversation
Member
|
This PR removes the Python 3.14+ compatibility handling that exists in master. The current _lacks_torch_jit_support = sys.version_info >= (3, 14)
# In setUp:
if not _lacks_torch_jit_support:
m = torch.jit.script(model)
...
# On tests:
@unittest.skipIf(_lacks_torch_jit_support, "PyTorch 2.9.1 JIT broken with Python 3.14+")
def test_torchscript_wrapper(self):
...The PR removes all of this and unconditionally calls Why it fails: Python 3.14 removed PyTorch won't fix this because TorchScript is deprecated as of PyTorch 2.9 (replaced by Fix: Preserve the import sys
_lacks_torch_jit_support = sys.version_info >= (3, 14)
def setUp(self):
self.tmpdir = tempfile.TemporaryDirectory()
tmppath = Path(self.tmpdir.name)
model = models.mobilenet_v2()
self.filename_v1_3 = tmppath / "test_model.pth"
torch.save(model, self.filename_v1_3)
if not _lacks_torch_jit_support:
m = torch.jit.script(model)
self.torchscript_filename = tmppath / "test_model_torchscript.pth"
torch.jit.save(m, self.torchscript_filename)And keep the Refs: |
1302886 to
a0b7265
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reduces the number of files created in the local folder. This PR doesn't touch the public API that sometimes expects file paths as arguments, so there will still be a few files here and here the associated tests.