-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2573 from melissa-kun-li/fix-sphinx-upload-docs
Fix error uploading Sphinx doc with upload_docs. Fixes #1060
- Loading branch information
Showing
5 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used. | ||
Note: :code:`upload_docs` is deprecated for PyPi, but is supported for other sites -- by :user:`melissa-kun-li` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import pytest | ||
import os | ||
|
||
from setuptools.command.upload_docs import upload_docs | ||
from setuptools.dist import Distribution | ||
|
||
|
||
@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::\ | ||
: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() |