(
fixture_dir: FixtureDirGetter,
tmp_path: Path,
no_plugins: bool,
with_project_plugins: bool,
mocker: MockerFixture,
set_project_context: SetProjectContext,
)
| 99 | @pytest.mark.parametrize("with_project_plugins", [False, True]) |
| 100 | @pytest.mark.parametrize("no_plugins", [False, True]) |
| 101 | def test_application_project_plugins( |
| 102 | fixture_dir: FixtureDirGetter, |
| 103 | tmp_path: Path, |
| 104 | no_plugins: bool, |
| 105 | with_project_plugins: bool, |
| 106 | mocker: MockerFixture, |
| 107 | set_project_context: SetProjectContext, |
| 108 | ) -> None: |
| 109 | env = MockEnv( |
| 110 | path=tmp_path / "env", version_info=(3, 8, 0), sys_path=[str(tmp_path / "env")] |
| 111 | ) |
| 112 | mocker.patch.object(EnvManager, "get_system_env", return_value=env) |
| 113 | |
| 114 | orig_dir = fixture_dir("project_plugins") |
| 115 | project_path = tmp_path / "project" |
| 116 | project_path.mkdir() |
| 117 | shutil.copy(orig_dir / "pyproject.toml", project_path / "pyproject.toml") |
| 118 | project_plugin_path = project_path / ProjectPluginCache.PATH |
| 119 | if with_project_plugins: |
| 120 | project_plugin_path.mkdir(parents=True) |
| 121 | |
| 122 | with set_project_context(project_path, in_place=True): |
| 123 | app = Application() |
| 124 | |
| 125 | tester = ApplicationTester(app) |
| 126 | tester.execute("--no-plugins" if no_plugins else "") |
| 127 | |
| 128 | assert tester.status_code == 0 |
| 129 | sys_path = EnvManager.get_system_env(naive=True).sys_path |
| 130 | if with_project_plugins and not no_plugins: |
| 131 | assert sys_path[0] == str(project_plugin_path) |
| 132 | else: |
| 133 | assert sys_path[0] != str(project_plugin_path) |
| 134 | |
| 135 | |
| 136 | @pytest.mark.parametrize("disable_cache", [True, False]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…