tests: fix windows tests (#5054)

* [WIP] git: use dulwich for add/commit

* dulwich: add is_tracked implementation

* experiments: try to workaround windows cleanup() bug on py < 3.8

* tests: experiments: convert CRLF to LF before comparing params
This commit is contained in:
Ruslan Kuprieiev
2020-12-08 23:41:09 +02:00
committed by GitHub
parent 995287bbba
commit 475fe544f0
3 changed files with 47 additions and 6 deletions
+10 -2
View File
@@ -235,11 +235,19 @@ def test_update_py_params(tmp_dir, scm, dvc):
"class Klass:\n def __init__(self):\n self.a = 222"
)
def _dos2unix(text):
if os.name != "nt":
return text
# NOTE: git on windows will use CRLF, so we have to convert it to LF
# in order to compare with the original
return text.replace("\r\n", "\n")
tree = scm.get_tree(exp_a)
with tree.open(tmp_dir / "params.py") as fobj:
assert fobj.read().strip() == result
assert _dos2unix(fobj.read().strip()) == result
with tree.open(tmp_dir / "metrics.py") as fobj:
assert fobj.read().strip() == result
assert _dos2unix(fobj.read().strip()) == result
tmp_dir.gen("params.py", "INT = 1\n")
stage = dvc.run(