summaryrefslogtreecommitdiff
path: root/tests/test_setup_command.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-03-05 15:25:47 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-03-05 18:49:17 +0000
commitf435fc05e68654a0cb1f36aecaf5100fcf171ee8 (patch)
tree4eb4a96a94df16296e81ca091e0ebc7cd85c8d12 /tests/test_setup_command.py
parent219d71315cd59685f4f99c8def4e8f692611e6c8 (diff)
downloadsphinx-git-f435fc05e68654a0cb1f36aecaf5100fcf171ee8.tar.gz
Prefer ``contextlib.chdir`` to ``sphinx.util.osutil.cd``
Diffstat (limited to 'tests/test_setup_command.py')
-rw-r--r--tests/test_setup_command.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/test_setup_command.py b/tests/test_setup_command.py
index 3690bbfcc..897718874 100644
--- a/tests/test_setup_command.py
+++ b/tests/test_setup_command.py
@@ -9,7 +9,11 @@ from textwrap import dedent
import pytest
import sphinx
-from sphinx.util.osutil import cd
+
+try:
+ from contextlib import chdir
+except ImportError:
+ from sphinx.util.osutil import _chdir as chdir
@pytest.fixture()
@@ -24,7 +28,7 @@ def setup_command(request, tempdir, rootdir):
pkgrootdir = tempdir / 'test-setup'
(rootdir / 'test-setup').copytree(pkgrootdir)
- with cd(pkgrootdir):
+ with chdir(pkgrootdir):
pythonpath = os.path.dirname(os.path.dirname(sphinx.__file__))
if os.getenv('PYTHONPATH'):
pythonpath = os.getenv('PYTHONPATH') + os.pathsep + pythonpath