From 1ac4144949c939731fb9592776ff855f18f4454b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danie=CC=88l=20de=20Kok?= Date: Wed, 25 Jan 2023 11:36:25 +0100 Subject: [PATCH] Try to solve Windows permission issue with `TemporaryDirectory` --- spacy/tests/test_cli.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/spacy/tests/test_cli.py b/spacy/tests/test_cli.py index db34e6f9f..1fffa8d22 100644 --- a/spacy/tests/test_cli.py +++ b/spacy/tests/test_cli.py @@ -1,6 +1,7 @@ import os import math from collections import Counter +from tempfile import TemporaryDirectory from typing import Tuple, List, Dict, Any import pkg_resources import time @@ -146,28 +147,30 @@ def test_issue11235(): def test_project_git_dir_asset(): - with make_tempdir() as d: + with TemporaryDirectory() as d: + p = Path(d) # Use a very small repo. git_checkout( "https://github.com/explosion/os-signpost.git", "os_signpost", - d / "signpost", + p / "signpost", branch="v0.0.3", ) - assert os.path.isdir(d / "signpost") + assert os.path.isdir(p / "signpost") @pytest.mark.issue(12168) def test_project_git_file_asset(): - with make_tempdir() as d: + with TemporaryDirectory() as d: + p = Path(d) # Use a very small repo. git_checkout( "https://github.com/explosion/os-signpost.git", "README.md", - d / "readme.md", + p / "readme.md", branch="v0.0.3", ) - assert os.path.isfile(d / "readme.md") + assert os.path.isfile(p / "readme.md") def test_cli_info():