This is an automated email from the ASF dual-hosted git repository.

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 56e69cbb321faf3a1ae619f6ce6c7fc799e925a7
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Apr 29 17:36:37 2026 -0400

    [#8603] disable trac importers by default
---
 Allura/allura/tests/unit/patches.py                        | 14 +++++++++++++-
 Allura/development.ini                                     |  9 +++++----
 .../forgeimporters/trac/tests/functional/test_trac.py      |  7 ++++++-
 ForgeImporters/forgeimporters/trac/tests/test_tickets.py   |  6 ++++++
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/Allura/allura/tests/unit/patches.py 
b/Allura/allura/tests/unit/patches.py
index d2b3551a3..a4c90456b 100644
--- a/Allura/allura/tests/unit/patches.py
+++ b/Allura/allura/tests/unit/patches.py
@@ -16,8 +16,9 @@
 #       under the License.
 
 from mock import Mock, patch, MagicMock
-from tg import tmpl_context as c
+from tg import tmpl_context as c, config
 import tg
+from tg.support.converters import aslist
 
 from allura.tests.unit.factories import (
     create_project,
@@ -67,3 +68,14 @@ def fake_request_patch(test_case):
 
 def fake_form_request_patch(test_case):
     return patch('tg.request', MagicMock(referer='.'))
+
+
+# to be used with a pytest fixture
+def enable_entry_point(config_key: str, entry_point_name: str):
+    orig_config_value = config.get(config_key, '')
+    items = aslist(orig_config_value, sep=',')
+    if entry_point_name in items:
+        items.remove(entry_point_name)
+    config[config_key] = ','.join(items)
+    yield
+    config[config_key] = orig_config_value
diff --git a/Allura/development.ini b/Allura/development.ini
index a0671e232..4cdaabeaa 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -517,13 +517,14 @@ importer_upload_path = 
/tmp/importer_upload/{nbhd}/{project}
 
 ; To disable any plugin, tool, importer, etc from being available, you can use 
the disable_entry_points config option.
 ; Specify the keys and values as they are declared in the tool's "setup.py" 
file.
-; Examples:
-;disable_entry_points.allura.importers = github-tracker, github-wiki, 
github-repo
-;disable_entry_points.allura.project_importers = github
+; Examples: github-tracker, github-wiki, github-repo
+disable_entry_points.allura.importers = trac-tickets
+; Examples: github, trac
+disable_entry_points.allura.project_importers = trac
 disable_entry_points.allura.theme.override = responsive
 
 ; Importers specifically, can be left enabled but not linked to.  You have to 
know the URL to use it.  Example:
-;hidden_importers = trac-tickets
+;hidden_importers = tt-tickets
 
 ; GitHub importer keys.  For github ticket import, it is best to set
 ; up an app at https://github.com/settings/developers  Use the root URL
diff --git a/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py 
b/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py
index c12823fbf..4cc80ecae 100644
--- a/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py
+++ b/ForgeImporters/forgeimporters/trac/tests/functional/test_trac.py
@@ -14,16 +14,21 @@
 #       KIND, either express or implied.  See the License for the
 #       specific language governing permissions and limitations
 #       under the License.
-
+import pytest
 from mock import patch
 from tg import config
 
 from allura.lib import helpers as h
 from allura.tests import TestController
+from allura.tests.unit.patches import enable_entry_point
 
 
 class TestTracImportController(TestController):
 
+    @pytest.fixture(autouse=True)
+    def enable_trac_entry_point(self):
+        yield from 
enable_entry_point('disable_entry_points.allura.project_importers', 'trac')
+
     def test_index(self):
         r = self.app.get('/p/import_project/trac/')
         assert 'Trac URL' in r
diff --git a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py 
b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
index 5da9166a1..f9b633b05 100644
--- a/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
+++ b/ForgeImporters/forgeimporters/trac/tests/test_tickets.py
@@ -22,6 +22,8 @@
 
 import pytest
 from mock import Mock, patch
+
+from allura.tests.unit.patches import enable_entry_point
 from ming.odm import ThreadLocalODMSession
 from tg import tmpl_context as c, config
 
@@ -115,6 +117,10 @@ def setup_method(self, method):
         from forgetracker.tracker_main import TrackerAdminController
         self.importer = TrackerAdminController._importer = 
TracTicketImportController(TracTicketImporter())
 
+    @pytest.fixture(autouse=True)
+    def enable_trac_entry_point(self):
+        yield from enable_entry_point('disable_entry_points.allura.importers', 
'trac-tickets')
+
     @with_tracker
     def test_index(self):
         r = self.app.get('/p/test/admin/bugs/_importer/')

Reply via email to