mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
tests: use repo_dir instead of custom fixtures
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user