diff --git a/readthedocs/doc_builder/base.py b/readthedocs/doc_builder/base.py index df9882c56f0..83aac0da617 100644 --- a/readthedocs/doc_builder/base.py +++ b/readthedocs/doc_builder/base.py @@ -46,7 +46,7 @@ def __init__(self, build_env, python_env, force=False): self.python_env = python_env self.version = build_env.version self.project = build_env.project - self.config = python_env.config + self.config = python_env.config if python_env else None self._force = force self.target = self.project.artifact_path( version=self.version.slug, type_=self.type) diff --git a/readthedocs/rtd_tests/tests/test_doc_builder.py b/readthedocs/rtd_tests/tests/test_doc_builder.py index 3de7192b4a7..b07668f1084 100644 --- a/readthedocs/rtd_tests/tests/test_doc_builder.py +++ b/readthedocs/rtd_tests/tests/test_doc_builder.py @@ -292,81 +292,6 @@ def test_append_conf_existing_yaml_on_root(self, checkout_path, run): 'mkdocs' ) - @patch('readthedocs.doc_builder.base.BaseBuilder.run') - @patch('readthedocs.projects.models.Project.checkout_path') - def test_override_theme_new_style(self, checkout_path, run): - tmpdir = tempfile.mkdtemp() - os.mkdir(os.path.join(tmpdir, 'docs')) - yaml_file = os.path.join(tmpdir, 'mkdocs.yml') - yaml.safe_dump( - { - 'theme': { - 'name': 'readthedocs', - }, - 'site_name': 'mkdocs', - 'docs_dir': 'docs', - }, - open(yaml_file, 'w') - ) - checkout_path.return_value = tmpdir - - python_env = Virtualenv( - version=self.version, - build_env=self.build_env, - config=None, - ) - self.searchbuilder = MkdocsHTML( - build_env=self.build_env, - python_env=python_env, - ) - self.searchbuilder.append_conf() - - run.assert_called_with('cat', 'mkdocs.yml', cwd=mock.ANY) - - config = yaml.safe_load(open(yaml_file)) - self.assertEqual( - config['theme'], - { - 'name': 'readthedocs', - 'custom_dir': BaseMkdocs.READTHEDOCS_TEMPLATE_OVERRIDE_DIR - } - ) - - @patch('readthedocs.doc_builder.base.BaseBuilder.run') - @patch('readthedocs.projects.models.Project.checkout_path') - def test_override_theme_old_style(self, checkout_path, run): - tmpdir = tempfile.mkdtemp() - os.mkdir(os.path.join(tmpdir, 'docs')) - yaml_file = os.path.join(tmpdir, 'mkdocs.yml') - yaml.safe_dump( - { - 'theme': 'readthedocs', - 'site_name': 'mkdocs', - 'docs_dir': 'docs', - }, - open(yaml_file, 'w') - ) - checkout_path.return_value = tmpdir - - python_env = Virtualenv( - version=self.version, - build_env=self.build_env, - config=None, - ) - self.searchbuilder = MkdocsHTML( - build_env=self.build_env, - python_env=python_env, - ) - self.searchbuilder.append_conf() - - run.assert_called_with('cat', 'mkdocs.yml', cwd=mock.ANY) - - config = yaml.safe_load(open(yaml_file)) - self.assertEqual( - config['theme_dir'], - BaseMkdocs.READTHEDOCS_TEMPLATE_OVERRIDE_DIR - ) - @patch('readthedocs.doc_builder.base.BaseBuilder.run') @patch('readthedocs.projects.models.Project.checkout_path') def test_dont_override_theme(self, checkout_path, run):