Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 16aee5c

Browse files
committed
Replace tmpdir with tmp_path
1 parent ada39dc commit 16aee5c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/matplotlib/tests/test_sphinxext.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
minversion=None if sys.version_info < (3, 10) else '4.1.3')
1515

1616

17-
def test_tinypages(tmpdir):
18-
source_dir = Path(tmpdir) / 'src'
17+
def test_tinypages(tmp_path):
18+
source_dir = tmp_path / 'src'
1919
shutil.copytree(Path(__file__).parent / 'tinypages', source_dir)
2020
html_dir = source_dir / '_build' / 'html'
2121
doctree_dir = source_dir / 'doctrees'
@@ -98,8 +98,8 @@ def plot_directive_file(num):
9898
assert filecmp.cmp(range_6, plot_file(5))
9999

100100

101-
def test_plot_html_show_source_link(tmpdir):
102-
source_dir = Path(tmpdir) / 'src'
101+
def test_plot_html_show_source_link(tmp_path):
102+
source_dir = tmp_path / 'src'
103103
source_dir.mkdir()
104104
parent = Path(__file__).parent
105105
shutil.copyfile(parent / 'tinypages/conf.py', source_dir / 'conf.py')
@@ -123,10 +123,10 @@ def test_plot_html_show_source_link(tmpdir):
123123

124124

125125
@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])
126-
def test_show_source_link_true(tmpdir, plot_html_show_source_link):
126+
def test_show_source_link_true(tmp_path, plot_html_show_source_link):
127127
# Test that a source link is generated if :show-source-link: is true,
128128
# whether or not plot_html_show_source_link is true.
129-
source_dir = Path(tmpdir) / 'src'
129+
source_dir = tmp_path / 'src'
130130
source_dir.mkdir()
131131
parent = Path(__file__).parent
132132
shutil.copyfile(parent / 'tinypages/conf.py', source_dir / 'conf.py')
@@ -145,10 +145,10 @@ def test_show_source_link_true(tmpdir, plot_html_show_source_link):
145145

146146

147147
@pytest.mark.parametrize('plot_html_show_source_link', [0, 1])
148-
def test_show_source_link_false(tmpdir, plot_html_show_source_link):
148+
def test_show_source_link_false(tmp_path, plot_html_show_source_link):
149149
# Test that a source link is NOT generated if :show-source-link: is false,
150150
# whether or not plot_html_show_source_link is true.
151-
source_dir = Path(tmpdir) / 'src'
151+
source_dir = tmp_path / 'src'
152152
source_dir.mkdir()
153153
parent = Path(__file__).parent
154154
shutil.copyfile(parent / 'tinypages/conf.py', source_dir / 'conf.py')

0 commit comments

Comments
 (0)