Skip to content

Commit a6912a4

Browse files
committed
Add docstring and mark test as failed when Exception raised
1 parent 2156b72 commit a6912a4

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

readthedocs/rtd_tests/tests/test_doc_builder.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from django.test import TestCase
99
from mock import patch
10+
import pytest
1011

1112
from readthedocs.doc_builder.backends.sphinx import BaseSphinx
1213
from readthedocs.projects.exceptions import ProjectConfigurationError
@@ -34,7 +35,21 @@ def setUp(self):
3435
@patch('readthedocs.doc_builder.backends.sphinx.BaseSphinx.run')
3536
@patch('readthedocs.builds.models.Version.get_conf_py_path')
3637
def test_create_conf_py(self, get_conf_py_path, run, get_config_params, create_index):
38+
"""
39+
Test for a project without ``conf.py`` file.
40+
41+
When this happen, the ``get_conf_py_path`` raises a
42+
``ProjectConfigurationError`` which is captured by our own code and
43+
generates a conf.py file based using our own template.
44+
45+
This template should be properly rendered in Python2 and Python3 without
46+
any kind of exception raised by ``append_conf`` (we were originally
47+
having a ``TypeError`` because of an encoding problem in Python3)
48+
"""
3749
create_index.return_value = 'README.rst'
3850
get_config_params.return_value = {}
3951
get_conf_py_path.side_effect = ProjectConfigurationError
40-
self.base_sphinx.append_conf()
52+
try:
53+
self.base_sphinx.append_conf()
54+
except Exception:
55+
pytest.fail('Exception was generated when append_conf called.')

0 commit comments

Comments
 (0)