From 9865dec3d3e68ac45c5f2c455b2d79ec54f12721 Mon Sep 17 00:00:00 2001 From: Vincent Moens Date: Thu, 2 Nov 2023 14:07:11 -0400 Subject: [PATCH] [Test] Fix as_tensor test (#551) --- .github/unittest/linux/scripts/install.sh | 7 +++++-- test/test_tensordict.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/unittest/linux/scripts/install.sh b/.github/unittest/linux/scripts/install.sh index 65904ffe1..07557287a 100755 --- a/.github/unittest/linux/scripts/install.sh +++ b/.github/unittest/linux/scripts/install.sh @@ -47,7 +47,10 @@ printf "* Installing tensordict\n" python setup.py develop # install torchsnapshot nightly -python -m pip install git+https://github.com/pytorch/torchsnapshot --no-build-isolation - +if [[ "$TORCH_VERSION" == "nightly" ]]; then + python -m pip install git+https://github.com/pytorch/torchsnapshot --no-build-isolation +elif [[ "$TORCH_VERSION" == "stable" ]]; then + python -m pip install torchsnapshot +fi # smoke test python -c "import functorch;import torchsnapshot" diff --git a/test/test_tensordict.py b/test/test_tensordict.py index 7cfbe4105..cda4b72d8 100644 --- a/test/test_tensordict.py +++ b/test/test_tensordict.py @@ -2283,8 +2283,8 @@ def test_as_tensor(self, td_name, device): ): td.as_tensor() else: - with pytest.raises(AttributeError): - td.as_tensor() + # checks that it runs + td.as_tensor() def test_items_values_keys(self, td_name, device): torch.manual_seed(1)