Esempio n. 1
0
    def test__filter_no_plugin(self) -> None:
        mock_config("""\
[plugins]
enabled =
""")

        plugins = LoadedFilters().filter_release_plugins()
        self.assertEqual(len(plugins), 0)

        plugins = LoadedFilters().filter_project_plugins()
        self.assertEqual(len(plugins), 0)
Esempio n. 2
0
    def test__filter_project_blocklist_allowlist__pep503_normalize(self) -> None:
        mock_config(
            """\
[plugins]
enabled =
    blocklist_project
    allowlist_project

[blocklist]
packages =
    SampleProject
    trove----classifiers

[allowlist]
packages =
    SampleProject
    trove----classifiers
"""
        )

        plugins = {
            plugin.name: plugin for plugin in LoadedFilters().filter_project_plugins()
        }

        self.assertTrue(plugins["blocklist_project"].check_match(name="sampleproject"))
        self.assertTrue(
            plugins["blocklist_project"].check_match(name="trove-classifiers")
        )
        self.assertFalse(plugins["allowlist_project"].check_match(name="sampleproject"))
        self.assertFalse(
            plugins["allowlist_project"].check_match(name="trove-classifiers")
        )
Esempio n. 3
0
    def test__filter_project_plugins__loads(self) -> None:
        mock_config("""\
[plugins]
enabled = all
""")
        builtin_plugin_names = [
            "blacklist_project",
            "regex_project",
            "whitelist_project",
        ]

        plugins = LoadedFilters().filter_project_plugins()
        names = [plugin.name for plugin in plugins]
        for name in builtin_plugin_names:
            self.assertIn(name, names)
Esempio n. 4
0
    def test__filter_release_plugins__loads(self) -> None:
        mock_config("""\
[plugins]
enabled = all
""")
        builtin_plugin_names = [
            "blacklist_release",
            "prerelease_release",
            "regex_release",
            "latest_release",
        ]

        plugins = LoadedFilters().filter_release_plugins()
        names = [plugin.name for plugin in plugins]
        for name in builtin_plugin_names:
            self.assertIn(name, names)