mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-02 19:30:19 +03:00
Attempt to fix git cleanup on Windows
This commit is contained in:
parent
942a2c0913
commit
7268c4b94d
|
@ -1,8 +1,11 @@
|
||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typer.testing import CliRunner
|
|
||||||
import srsly
|
|
||||||
import pytest
|
import pytest
|
||||||
|
import shutil
|
||||||
|
import srsly
|
||||||
|
import stat
|
||||||
|
from typer.testing import CliRunner
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from spacy.cli._util import app
|
from spacy.cli._util import app
|
||||||
from .util import make_tempdir
|
from .util import make_tempdir
|
||||||
|
@ -101,12 +104,23 @@ def test_project_run(project_dir):
|
||||||
|
|
||||||
|
|
||||||
def test_project_clone():
|
def test_project_clone():
|
||||||
with make_tempdir() as workspace:
|
# Git clones create some readonly/hidden files. On Windows, trying to
|
||||||
|
# delete these gives an error, so we have to handle that specially.
|
||||||
|
|
||||||
|
workspace = Path(tempfile.mkdtemp())
|
||||||
|
|
||||||
|
def _fix_perms(func, path, exc_info):
|
||||||
|
os.chmod(path, stat.S_IWUSR)
|
||||||
|
func(path)
|
||||||
|
|
||||||
|
try:
|
||||||
out = workspace / "project"
|
out = workspace / "project"
|
||||||
target = "benchmarks/ner_conll03"
|
target = "benchmarks/ner_conll03"
|
||||||
result = CliRunner().invoke(app, ["project", "clone", target, str(out)])
|
result = CliRunner().invoke(app, ["project", "clone", target, str(out)])
|
||||||
assert result.exit_code == 0
|
assert result.exit_code == 0
|
||||||
assert (out / "README.md").is_file()
|
assert (out / "README.md").is_file()
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(str(workspace), ignore_errors=False, onerror=_fix_perms)
|
||||||
|
|
||||||
|
|
||||||
def test_project_push_pull(project_dir):
|
def test_project_push_pull(project_dir):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user