Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed Feb 8, 2022
1 parent 1738f5c commit a93231d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ develop =
../../test-packages/example.different
../../test-packages/example.different2
../../test-packages/example.metaoverrides
../../test-packages/example.plone-dash-addon
../../test-packages/example.ploneaddon
../../test-packages/example.ploneintegration
../../test-packages/example.zopeaddon
Expand Down
2 changes: 1 addition & 1 deletion src/plone/autoinclude/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def load_own_packages(target=""):
if target and eps["target"].module_name != target:
# entry point defines target X but we only want target Y.
continue
module_name = wsdist.project_name
module_name = wsdist.project_name.replace("-", "_")
if "module" in eps:
# We could load the dist with ep.load(), but we do it differently.
module_name = eps["module"].module_name
Expand Down
10 changes: 8 additions & 2 deletions src/plone/autoinclude/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,31 @@ def test_load_z3c_packages(self):
"example.multipleeps",
]:
self.assertIn(package, packages.keys())

package = packages["example.ploneaddon"]
import example.ploneaddon

self.assertEqual(package, example.ploneaddon)


def test_load_own_packages(self):
from plone.autoinclude.loader import load_own_packages

packages = load_own_packages()
for package in [
"example.somethingelse2",
"example.multipleeps",
"example.plone_dash_addon",
]:
self.assertIn(package, packages.keys())
package = packages["example.somethingelse2"]
import example.somethingelse2

self.assertEqual(package, example.somethingelse2)

package = packages["example.plone_dash_addon"]
import example.plone_dash_addon
self.assertEqual(package, example.plone_dash_addon)


def test_get_zcml_file(self):
from plone.autoinclude.loader import get_zcml_file

Expand Down
2 changes: 1 addition & 1 deletion test-packages/example.plone-dash-addon/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"setuptools",
],
entry_points="""
[z3c.autoinclude.plugin]
[plone.autoinclude.plugin]
target = plone
""",
)
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ deps =
-e test-packages/example.different2
-e test-packages/example.metaoverrides
-e test-packages/example.ploneaddon
-e test-packages/example.plone-dash-addon
-e test-packages/example.ploneintegration
-e test-packages/example.zopeaddon
-e test-packages/example.zopeintegration
Expand Down

0 comments on commit a93231d

Please sign in to comment.