tests: use repo_dir instead of custom fixtures

This commit is contained in:
Mr. Outis
2019-09-06 13:28:48 -05:00
parent b66996e0a1
commit 737f1e141d
3 changed files with 17 additions and 33 deletions
-10
View File
@@ -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()
+14 -20
View File
@@ -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")
+3 -3
View File
@@ -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")