summaryrefslogtreecommitdiff
path: root/setuptools/tests/test_sphinx_upload_docs.py
blob: cc5b8293bf48bbc3e71399aae02d26470ae27f83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import pytest

from jaraco import path

from setuptools.command.upload_docs import upload_docs
from setuptools.dist import Distribution


@pytest.fixture
def sphinx_doc_sample_project(tmpdir_cwd):
    path.build({
        'setup.py': 'from setuptools import setup; setup()',
        'build': {
            'docs': {
                'conf.py': 'project="test"',
                'index.rst': ".. toctree::\
                    :maxdepth: 2\
                    :caption: Contents:",
            },
        },
    })


@pytest.mark.usefixtures('sphinx_doc_sample_project')
class TestSphinxUploadDocs:
    def test_sphinx_doc(self):
        params = dict(
            name='foo',
            packages=['test'],
        )
        dist = Distribution(params)

        cmd = upload_docs(dist)

        cmd.initialize_options()
        assert cmd.upload_dir is None
        assert cmd.has_sphinx() is True
        cmd.finalize_options()