fix slow windows test (#49258)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/49258

Tested by adding
`time.sleep(3)
`
in SubProcess.run and see test print "test_inherit_tensor: SubProcess too slow"

Sample failure:
https://app.circleci.com/pipelines/github/pytorch/pytorch/249756/workflows/3605479e-1020-4325-9a4c-8bde5ae38262/jobs/9550663

Test Plan: Imported from OSS

Reviewed By: supriyar

Differential Revision: D25507209

Pulled By: agolynski

fbshipit-source-id: ec808f0f658d0fb4c8447f68ec5ceba2aa66b1b5
This commit is contained in:
Alexander Golynski
2020-12-12 06:46:55 -08:00
committed by Facebook GitHub Bot
parent cd927875e0
commit 33b7970d9e

View File

@ -368,8 +368,11 @@ class TestMultiprocessing(TestCase):
t = torch.zeros(5, 5)
p = SubProcess(t.share_memory_())
p.start()
p.join(1)
self.assertEqual(t, torch.ones(5, 5) * 3, atol=0, rtol=0)
p.join(2)
if p.exitcode is None:
print("test_inherit_tensor: SubProcess too slow")
else:
self.assertEqual(t, torch.ones(5, 5) * 3, atol=0, rtol=0)
@unittest.skipIf(IS_WINDOWS, "Test needs to use fork multiprocessing")
def test_autograd_errors(self):