Skip to content

Commit 34ff065

Browse files
committed
Config file: system_site_packages overwritten from project's setting
I created a test case to demostrate what was reported in the issue. Summarizing, if the project uses a config file and does not define `python.system_packages` but has `Project.use_system_packages=True` the config option is `True` which is wrong. When a config file is used, settings at Project level should be ignored as this messages from "Advanced settings" states: > These settings can be configured using a configuration file. That's the recommended way to set up your project. Settings listed here are ignored when using a configuration file. Reference #8782
1 parent b958bb8 commit 34ff065

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

readthedocs/rtd_tests/tests/test_config_integration.py

+32
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,38 @@ def test_system_packages(self, run, checkout_path, tmpdir):
767767
assert '--system-site-packages' in args
768768
assert config.python.use_system_site_packages
769769

770+
@patch('readthedocs.doc_builder.environments.BuildEnvironment.run')
771+
def test_system_packages_project_overrides(self, run, checkout_path, tmpdir):
772+
773+
# Define `project.use_system_packages` as if it was marked in the Advanced settings.
774+
self.version.project.use_system_packages = True
775+
self.version.project.save()
776+
777+
checkout_path.return_value = str(tmpdir)
778+
self.create_config_file(
779+
tmpdir,
780+
{
781+
# Do not define `system_packages: True` in the config file.
782+
'python': {},
783+
},
784+
)
785+
786+
update_docs = self.get_update_docs_task()
787+
config = update_docs.config
788+
789+
python_env = Virtualenv(
790+
version=self.version,
791+
build_env=update_docs.build_env,
792+
config=config,
793+
)
794+
update_docs.python_env = python_env
795+
update_docs.python_env.setup_base()
796+
797+
args, kwargs = run.call_args
798+
799+
assert '--system-site-packages' not in args
800+
assert not config.python.use_system_site_packages
801+
770802
@pytest.mark.parametrize(
771803
'value,result',
772804
[

0 commit comments

Comments
 (0)