From 8dc11417d292d1fc391bbc96af0ae6cc21305b47 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 23 Nov 2022 17:27:03 +0200 Subject: [PATCH] testing: api: test opening a file in subdir Related to #8420 --- dvc/testing/api_tests.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/dvc/testing/api_tests.py b/dvc/testing/api_tests.py index fa5ce0ecb..76f5017fa 100644 --- a/dvc/testing/api_tests.py +++ b/dvc/testing/api_tests.py @@ -13,14 +13,22 @@ class TestAPI: assert api.get_url("foo") == expected_url def test_open(self, tmp_dir, dvc, remote): - tmp_dir.dvc_gen("foo", "foo-text") + tmp_dir.dvc_gen( + { + "foo": "foo-text", + "dir": {"bar": "bar-text"}, + } + ) dvc.push() # Remove cache to force download remove(dvc.odb.local.path) - with api.open("foo") as fd: - assert fd.read() == "foo-text" + with api.open("foo") as fobj: + assert fobj.read() == "foo-text" + + with api.open("dir/bar") as fobj: + assert fobj.read() == "bar-text" @pytest.mark.parametrize( "clear_cache", [True, False], ids=["cache", "no_cache"]