diff --git a/tests/conftest.py b/tests/conftest.py index d5851b6a7..e9855056d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -178,16 +178,6 @@ def _close_pools(): close_pools() -@pytest.fixture -def chdir_tmp(tmp_path): - cwd = os.getcwd() - try: - os.chdir(str(tmp_path)) - yield - finally: - os.chdir(cwd) - - @pytest.fixture def git_erepo(): repo = TestGitFixture() diff --git a/tests/unit/remote/ssh/test_connection.py b/tests/unit/remote/ssh/test_connection.py index c458a6641..f90308e54 100644 --- a/tests/unit/remote/ssh/test_connection.py +++ b/tests/unit/remote/ssh/test_connection.py @@ -9,12 +9,6 @@ import filecmp from dvc.system import System -@pytest.fixture -def foo(): - with open("foo", "w") as fobj: - fobj.write("foo") - - here = os.path.abspath(os.path.dirname(__file__)) @@ -81,23 +75,23 @@ def test_walk(tmp_path, ssh): @pytest.mark.skipif( platform.system() != "Darwin", reason="Only works on OSX (because of APFS)" ) -def test_reflink(chdir_tmp, foo, ssh): - ssh.reflink("foo", "bar") - assert filecmp.cmp("foo", "bar") - assert not System.is_symlink("bar") - assert not System.is_hardlink("bar") +def test_reflink(repo_dir, ssh): + ssh.reflink("foo", "link") + assert filecmp.cmp("foo", "link") + assert not System.is_symlink("link") + assert not System.is_hardlink("link") -def test_symlink(chdir_tmp, foo, ssh): - ssh.symlink("foo", "bar") - assert System.is_symlink("bar") +def test_symlink(repo_dir, ssh): + ssh.symlink("foo", "link") + assert System.is_symlink("link") -def test_hardlink(chdir_tmp, foo, ssh): - ssh.hardlink("foo", "bar") - assert System.is_hardlink("bar") +def test_hardlink(repo_dir, ssh): + ssh.hardlink("foo", "link") + assert System.is_hardlink("link") -def test_copy(chdir_tmp, foo, ssh): - ssh.copy("foo", "bar") - assert filecmp.cmp("foo", "bar") +def test_copy(repo_dir, ssh): + ssh.copy("foo", "link") + assert filecmp.cmp("foo", "link") diff --git a/tests/unit/remote/ssh/test_ssh.py b/tests/unit/remote/ssh/test_ssh.py index 1668680c9..43a2c0efb 100644 --- a/tests/unit/remote/ssh/test_ssh.py +++ b/tests/unit/remote/ssh/test_ssh.py @@ -187,7 +187,7 @@ def test_ssh_gss_auth(mock_file, mock_exists, config, expected_gss_auth): assert remote.gss_auth == expected_gss_auth -def test_hardlink_optimization(chdir_tmp, ssh_server): +def test_hardlink_optimization(repo_dir, ssh_server): config = { "url": "ssh://localhost", "hostname": ssh_server.test_creds["host"], @@ -204,5 +204,5 @@ def test_hardlink_optimization(chdir_tmp, ssh_server): path = posixpath.abspath(path) return URLInfo("ssh://{}/{}".format(netloc, path)) - remote.hardlink(urlpath("empty"), urlpath("bar")) - assert not System.is_hardlink("bar") + remote.hardlink(urlpath("empty"), urlpath("link")) + assert not System.is_hardlink("link")