diff --git a/setuptools/tests/test_sphinx_upload_docs.py b/setuptools/tests/test_sphinx_upload_docs.py index a48ba7f8b38..cc5b8293bf4 100644 --- a/setuptools/tests/test_sphinx_upload_docs.py +++ b/setuptools/tests/test_sphinx_upload_docs.py @@ -1,5 +1,6 @@ import pytest -import os + +from jaraco import path from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution @@ -7,21 +8,17 @@ @pytest.fixture def sphinx_doc_sample_project(tmpdir_cwd): - # setup.py - with open('setup.py', 'wt') as f: - f.write('from setuptools import setup; setup()\n') - - os.makedirs('build/docs') - - # A test conf.py for Sphinx - with open('build/docs/conf.py', 'w') as f: - f.write("project = 'test'") - - # A test index.rst for Sphinx - with open('build/docs/index.rst', 'w') as f: - f.write(".. toctree::\ + path.build({ + 'setup.py': 'from setuptools import setup; setup()', + 'build': { + 'docs': { + 'conf.py': 'project="test"', + 'index.rst': ".. toctree::\ :maxdepth: 2\ - :caption: Contents:") + :caption: Contents:", + }, + }, + }) @pytest.mark.usefixtures('sphinx_doc_sample_project') diff --git a/setuptools/tests/test_upload_docs.py b/setuptools/tests/test_upload_docs.py index a26e32a61d2..55978aadc70 100644 --- a/setuptools/tests/test_upload_docs.py +++ b/setuptools/tests/test_upload_docs.py @@ -3,6 +3,7 @@ import contextlib import pytest +from jaraco import path from setuptools.command.upload_docs import upload_docs from setuptools.dist import Distribution @@ -10,28 +11,20 @@ from .textwrap import DALS from . import contexts -SETUP_PY = DALS( - """ - from setuptools import setup - - setup(name='foo') - """) - @pytest.fixture def sample_project(tmpdir_cwd): - # setup.py - with open('setup.py', 'wt') as f: - f.write(SETUP_PY) - - os.mkdir('build') - - # A test document. - with open('build/index.html', 'w') as f: - f.write("Hello world.") - - # An empty folder. - os.mkdir('build/empty') + path.build({ + 'setup.py': DALS(""" + from setuptools import setup + + setup(name='foo') + """), + 'build': { + 'index.html': 'Hello world.', + 'empty': {}, + } + }) @pytest.mark.usefixtures('sample_project')