plonecli 7.0a1__tar.gz → 7.0a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {plonecli-7.0a1 → plonecli-7.0a3}/CHANGES.rst +14 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/PKG-INFO +33 -4
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli/cli.py +1 -1
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli/registry.py +23 -6
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/PKG-INFO +33 -4
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/SOURCES.txt +1 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/requires.txt +1 -1
- plonecli-7.0a3/pyproject.toml +13 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/setup.cfg +1 -1
- {plonecli-7.0a1 → plonecli-7.0a3}/setup.py +1 -1
- plonecli-7.0a3/tests/test_plonecli.py +234 -0
- plonecli-7.0a3/tests/test_registry.py +108 -0
- plonecli-7.0a1/tests/test_plonecli.py +0 -234
- plonecli-7.0a1/tests/test_registry.py +0 -108
- {plonecli-7.0a1 → plonecli-7.0a3}/AUTHORS.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/CONTRIBUTING.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/LICENSE +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/MANIFEST.in +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/README.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/Makefile +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/authors.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/conf.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/contributing.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/history.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/index.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/installation.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/make.bat +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plone_cli_logo.png +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plone_cli_logo.svg +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plonecli_add_content_type_optimized.gif +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plonecli_add_theme_optimized.gif +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plonecli_add_vocabulary_optimized.gif +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plonecli_build_optimized.gif +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plonecli_create_addon_optimized.gif +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/plonecli_serve_optimized.gif +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/docs/readme.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli/__init__.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli/configure_mrbob/.mrbob.ini +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli/configure_mrbob.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli/exceptions.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/dependency_links.txt +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/entry_points.txt +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/not-zip-safe +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.egg-info/top_level.txt +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli.rst +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/plonecli_autocomplete.sh +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/requirements.txt +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/tests/__init__.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/tests/conftest.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/tests/test_configure_mrbob.py +0 -0
- {plonecli-7.0a1 → plonecli-7.0a3}/tox.ini +0 -0
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
History
|
|
2
2
|
=======
|
|
3
3
|
|
|
4
|
+
7.0a3 (2025-08-20)
|
|
5
|
+
------------------
|
|
6
|
+
|
|
7
|
+
- fix tmplate registry
|
|
8
|
+
[MrTango]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
7.0a2 (2025-05-30)
|
|
12
|
+
------------------
|
|
13
|
+
|
|
14
|
+
- fix lookup of bobtemplates-plone templates
|
|
15
|
+
[MrTango]
|
|
16
|
+
|
|
17
|
+
|
|
4
18
|
7.0a1 (2025-05-30)
|
|
5
19
|
------------------
|
|
6
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: plonecli
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.0a3
|
|
4
4
|
Summary: A Plone CLI for creating Plone packages
|
|
5
5
|
Home-page: https://github.com/plone/plonecli
|
|
6
6
|
Author: Maik Derstappen
|
|
@@ -26,10 +26,25 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
26
26
|
Classifier: Programming Language :: Python :: 3.9
|
|
27
27
|
Classifier: Programming Language :: Python :: 3.10
|
|
28
28
|
Requires-Python: >=3.6
|
|
29
|
-
Provides-Extra: test
|
|
30
|
-
Provides-Extra: dev
|
|
31
29
|
License-File: LICENSE
|
|
32
30
|
License-File: AUTHORS.rst
|
|
31
|
+
Requires-Dist: setuptools
|
|
32
|
+
Requires-Dist: Click>=7.0
|
|
33
|
+
Requires-Dist: click-aliases
|
|
34
|
+
Requires-Dist: mr.bob
|
|
35
|
+
Requires-Dist: bobtemplates.plone>=7.0.0a4
|
|
36
|
+
Requires-Dist: tox
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: pytest; extra == "test"
|
|
39
|
+
Requires-Dist: isort>=5.0.0; extra == "test"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: tox; extra == "dev"
|
|
42
|
+
Requires-Dist: zest.releaser[recommended]; extra == "dev"
|
|
43
|
+
Dynamic: keywords
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
Dynamic: provides-extra
|
|
46
|
+
Dynamic: requires-dist
|
|
47
|
+
Dynamic: requires-python
|
|
33
48
|
|
|
34
49
|
.. image:: https://github.com/plone/plonecli/actions/workflows/python-package.yml/badge.svg
|
|
35
50
|
:target: https://github.com/plone/plonecli/actions/workflows/python-package.yml
|
|
@@ -408,6 +423,20 @@ This project is licensed under the BSD license.
|
|
|
408
423
|
History
|
|
409
424
|
=======
|
|
410
425
|
|
|
426
|
+
7.0a3 (2025-08-20)
|
|
427
|
+
------------------
|
|
428
|
+
|
|
429
|
+
- fix tmplate registry
|
|
430
|
+
[MrTango]
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
7.0a2 (2025-05-30)
|
|
434
|
+
------------------
|
|
435
|
+
|
|
436
|
+
- fix lookup of bobtemplates-plone templates
|
|
437
|
+
[MrTango]
|
|
438
|
+
|
|
439
|
+
|
|
411
440
|
7.0a1 (2025-05-30)
|
|
412
441
|
------------------
|
|
413
442
|
|
|
@@ -59,7 +59,7 @@ def cli(context, list_templates, versions):
|
|
|
59
59
|
click.echo(reg.list_templates())
|
|
60
60
|
if versions:
|
|
61
61
|
ws = WorkingSet()
|
|
62
|
-
bobtemplates_dist = ws.by_key["bobtemplates
|
|
62
|
+
bobtemplates_dist = ws.by_key["bobtemplates-plone"]
|
|
63
63
|
bobtemplates_version = bobtemplates_dist.version
|
|
64
64
|
plonecli_version = ws.by_key["plonecli"].version
|
|
65
65
|
version_str = """Available packages:\n
|
|
@@ -79,7 +79,6 @@ class TemplateRegistry(object):
|
|
|
79
79
|
for entry_point in pkg_resources.iter_entry_points("mrbob_templates"):
|
|
80
80
|
template_info_method = entry_point.load()
|
|
81
81
|
self.template_infos[entry_point.name] = template_info_method()
|
|
82
|
-
|
|
83
82
|
for entry_point_name, tmpl_info in self.template_infos.items():
|
|
84
83
|
if tmpl_info.depend_on:
|
|
85
84
|
continue
|
|
@@ -94,14 +93,18 @@ class TemplateRegistry(object):
|
|
|
94
93
|
if not tmpl_info.depend_on:
|
|
95
94
|
continue
|
|
96
95
|
if tmpl_info.depend_on not in self.templates:
|
|
96
|
+
# Create virtual parent template if it doesn't exist
|
|
97
|
+
self.templates[tmpl_info.depend_on] = {
|
|
98
|
+
"template_name": tmpl_info.depend_on.replace('plone_', ''),
|
|
99
|
+
"subtemplates": {},
|
|
100
|
+
"info": "Virtual template for subtemplates",
|
|
101
|
+
"deprecated": False,
|
|
102
|
+
}
|
|
97
103
|
print(
|
|
98
|
-
"{"
|
|
99
|
-
'Template dependency "{0}" not found!'.format(
|
|
104
|
+
"Created virtual template '{0}' for subtemplates".format(
|
|
100
105
|
tmpl_info.depend_on,
|
|
101
106
|
),
|
|
102
|
-
"}",
|
|
103
107
|
)
|
|
104
|
-
continue
|
|
105
108
|
self.templates[tmpl_info.depend_on]["subtemplates"][entry_point_name] = (
|
|
106
109
|
tmpl_info.plonecli_alias or entry_point_name
|
|
107
110
|
)
|
|
@@ -147,4 +150,18 @@ class TemplateRegistry(object):
|
|
|
147
150
|
return template_name
|
|
148
151
|
|
|
149
152
|
|
|
150
|
-
|
|
153
|
+
# Lazy initialization to ensure correct working directory
|
|
154
|
+
_template_registry = None
|
|
155
|
+
|
|
156
|
+
def get_template_registry():
|
|
157
|
+
global _template_registry
|
|
158
|
+
if _template_registry is None:
|
|
159
|
+
_template_registry = TemplateRegistry()
|
|
160
|
+
return _template_registry
|
|
161
|
+
|
|
162
|
+
# For backward compatibility
|
|
163
|
+
class LazyTemplateRegistry:
|
|
164
|
+
def __getattr__(self, name):
|
|
165
|
+
return getattr(get_template_registry(), name)
|
|
166
|
+
|
|
167
|
+
template_registry = LazyTemplateRegistry()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: plonecli
|
|
3
|
-
Version: 7.
|
|
3
|
+
Version: 7.0a3
|
|
4
4
|
Summary: A Plone CLI for creating Plone packages
|
|
5
5
|
Home-page: https://github.com/plone/plonecli
|
|
6
6
|
Author: Maik Derstappen
|
|
@@ -26,10 +26,25 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
26
26
|
Classifier: Programming Language :: Python :: 3.9
|
|
27
27
|
Classifier: Programming Language :: Python :: 3.10
|
|
28
28
|
Requires-Python: >=3.6
|
|
29
|
-
Provides-Extra: test
|
|
30
|
-
Provides-Extra: dev
|
|
31
29
|
License-File: LICENSE
|
|
32
30
|
License-File: AUTHORS.rst
|
|
31
|
+
Requires-Dist: setuptools
|
|
32
|
+
Requires-Dist: Click>=7.0
|
|
33
|
+
Requires-Dist: click-aliases
|
|
34
|
+
Requires-Dist: mr.bob
|
|
35
|
+
Requires-Dist: bobtemplates.plone>=7.0.0a4
|
|
36
|
+
Requires-Dist: tox
|
|
37
|
+
Provides-Extra: test
|
|
38
|
+
Requires-Dist: pytest; extra == "test"
|
|
39
|
+
Requires-Dist: isort>=5.0.0; extra == "test"
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: tox; extra == "dev"
|
|
42
|
+
Requires-Dist: zest.releaser[recommended]; extra == "dev"
|
|
43
|
+
Dynamic: keywords
|
|
44
|
+
Dynamic: license-file
|
|
45
|
+
Dynamic: provides-extra
|
|
46
|
+
Dynamic: requires-dist
|
|
47
|
+
Dynamic: requires-python
|
|
33
48
|
|
|
34
49
|
.. image:: https://github.com/plone/plonecli/actions/workflows/python-package.yml/badge.svg
|
|
35
50
|
:target: https://github.com/plone/plonecli/actions/workflows/python-package.yml
|
|
@@ -408,6 +423,20 @@ This project is licensed under the BSD license.
|
|
|
408
423
|
History
|
|
409
424
|
=======
|
|
410
425
|
|
|
426
|
+
7.0a3 (2025-08-20)
|
|
427
|
+
------------------
|
|
428
|
+
|
|
429
|
+
- fix tmplate registry
|
|
430
|
+
[MrTango]
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
7.0a2 (2025-05-30)
|
|
434
|
+
------------------
|
|
435
|
+
|
|
436
|
+
- fix lookup of bobtemplates-plone templates
|
|
437
|
+
[MrTango]
|
|
438
|
+
|
|
439
|
+
|
|
411
440
|
7.0a1 (2025-05-30)
|
|
412
441
|
------------------
|
|
413
442
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# [project]
|
|
2
|
+
# name = "plonecli"
|
|
3
|
+
# version = "0.1.0"
|
|
4
|
+
# description = "Add your description here"
|
|
5
|
+
# readme = "README.md"
|
|
6
|
+
# requires-python = ">=3.12"
|
|
7
|
+
# dependencies = [
|
|
8
|
+
# "bobtemplates.plone>=7.0.0a4",
|
|
9
|
+
# "Click>=7.0",
|
|
10
|
+
# "click-aliases",
|
|
11
|
+
# "mr.bob",
|
|
12
|
+
# "tox",
|
|
13
|
+
# ]
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
|
|
4
|
+
"""Tests for `plonecli` package."""
|
|
5
|
+
|
|
6
|
+
from __future__ import absolute_import
|
|
7
|
+
|
|
8
|
+
from click.testing import CliRunner
|
|
9
|
+
from plonecli import cli
|
|
10
|
+
|
|
11
|
+
import click
|
|
12
|
+
import os
|
|
13
|
+
import pytest
|
|
14
|
+
import subprocess
|
|
15
|
+
import sys
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.fixture
|
|
19
|
+
def response():
|
|
20
|
+
"""Sample pytest fixture.
|
|
21
|
+
|
|
22
|
+
See more at: http://doc.pytest.org/en/latest/fixture.html
|
|
23
|
+
"""
|
|
24
|
+
# import requests
|
|
25
|
+
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_content(response):
|
|
29
|
+
"""Sample pytest test function with the pytest fixture as an argument."""
|
|
30
|
+
# from bs4 import BeautifulSoup
|
|
31
|
+
# assert 'GitHub' in BeautifulSoup(response.content).title.string
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def test_command_line_interface():
|
|
35
|
+
"""Test the CLI."""
|
|
36
|
+
runner = CliRunner()
|
|
37
|
+
result = runner.invoke(cli.cli)
|
|
38
|
+
assert result.exit_code == 0
|
|
39
|
+
# assert 'Plone Command Line Interface' in result.output
|
|
40
|
+
|
|
41
|
+
help_result = runner.invoke(cli.cli, ["--help"])
|
|
42
|
+
assert help_result.exit_code == 0
|
|
43
|
+
assert "Usage: cli" in help_result.output
|
|
44
|
+
|
|
45
|
+
help_result = runner.invoke(cli.cli, ["-h"])
|
|
46
|
+
assert help_result.exit_code == 0
|
|
47
|
+
assert "Usage: cli" in help_result.output
|
|
48
|
+
|
|
49
|
+
version_result = runner.invoke(cli.cli, ["-V"])
|
|
50
|
+
assert version_result.exit_code == 0
|
|
51
|
+
assert "Available packages:" in version_result.output
|
|
52
|
+
|
|
53
|
+
version_result = runner.invoke(cli.cli, ["--versions"])
|
|
54
|
+
assert version_result.exit_code == 0
|
|
55
|
+
assert "Available packages:" in version_result.output
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# def test_plonecli_test():
|
|
59
|
+
# runner = CliRunner()
|
|
60
|
+
# template = """[main]
|
|
61
|
+
# version = 5.1-latest
|
|
62
|
+
# template = plone_addon
|
|
63
|
+
# git_init = y
|
|
64
|
+
# """
|
|
65
|
+
# with runner.isolated_filesystem():
|
|
66
|
+
# with open("bobtemplate.cfg", "w") as f:
|
|
67
|
+
# f.write(template)
|
|
68
|
+
# context = click.Context(cli.run_test)
|
|
69
|
+
# context.obj = {}
|
|
70
|
+
# context.obj["target_dir"] = os.path.dirname(os.path.abspath("bobtemplate.cfg"))
|
|
71
|
+
|
|
72
|
+
# test_command_result_a = runner.invoke(
|
|
73
|
+
# cli.run_test, args=["--all"], obj=context.obj,
|
|
74
|
+
# )
|
|
75
|
+
# assert u"\nRUN: ./bin/test --all" in test_command_result_a.output
|
|
76
|
+
|
|
77
|
+
# test_command_result_t_a = runner.invoke(
|
|
78
|
+
# cli.run_test,
|
|
79
|
+
# args=["-t src/collective/todo/tests/test_robot.py", "-a"],
|
|
80
|
+
# obj=context.obj,
|
|
81
|
+
# )
|
|
82
|
+
# assert (
|
|
83
|
+
# u"./bin/test --test src/collective/todo/tests/test_robot.py --all"
|
|
84
|
+
# in test_command_result_t_a.output
|
|
85
|
+
# ) # NOQA: E501
|
|
86
|
+
|
|
87
|
+
# test_command_result_s_a = runner.invoke(
|
|
88
|
+
# cli.run_test, args=["-s collective.todo", "-a"], obj=context.obj,
|
|
89
|
+
# )
|
|
90
|
+
# assert (
|
|
91
|
+
# u"./bin/test --package collective.todo --all"
|
|
92
|
+
# in test_command_result_s_a.output
|
|
93
|
+
# ) # NOQA: E501
|
|
94
|
+
|
|
95
|
+
# test_command_result_t_s = runner.invoke(
|
|
96
|
+
# cli.run_test,
|
|
97
|
+
# args=["-t src/collective/todo/tests/test_robot.py", "-s collective.todo"],
|
|
98
|
+
# obj=context.obj,
|
|
99
|
+
# )
|
|
100
|
+
# assert (
|
|
101
|
+
# u"./bin/test --test src/collective/todo/tests/test_robot.py --package collective.todo"
|
|
102
|
+
# in test_command_result_t_s.output
|
|
103
|
+
# ) # NOQA: E501
|
|
104
|
+
|
|
105
|
+
# test_command_result = runner.invoke(
|
|
106
|
+
# cli.run_test,
|
|
107
|
+
# args=[
|
|
108
|
+
# "-t src/collective/todo/tests/test_robot.py",
|
|
109
|
+
# "-s collective.todo",
|
|
110
|
+
# "--all",
|
|
111
|
+
# ],
|
|
112
|
+
# obj=context.obj,
|
|
113
|
+
# )
|
|
114
|
+
# assert (
|
|
115
|
+
# u"./bin/test --test src/collective/todo/tests/test_robot.py --package collective.todo --all"
|
|
116
|
+
# in test_command_result.output
|
|
117
|
+
# ) # NOQA: E501
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# def test_plonecli_build_default_py(tmpdir, plonecli_bin):
|
|
121
|
+
# target_path = tmpdir.strpath
|
|
122
|
+
# os.chdir(target_path)
|
|
123
|
+
# template = """
|
|
124
|
+
# setuptools==40.8.0
|
|
125
|
+
# zc.buildout==2.13.1
|
|
126
|
+
# """
|
|
127
|
+
# with open("requirements.txt", "w") as f:
|
|
128
|
+
# f.write(template)
|
|
129
|
+
|
|
130
|
+
# template = """[buildout]
|
|
131
|
+
# parts =
|
|
132
|
+
# """
|
|
133
|
+
# with open("buildout.cfg", "w") as f:
|
|
134
|
+
# f.write(template)
|
|
135
|
+
|
|
136
|
+
# template = """[main]
|
|
137
|
+
# version = 5.2.2
|
|
138
|
+
# template = plone_addon
|
|
139
|
+
# python = python3
|
|
140
|
+
# git_init = y
|
|
141
|
+
# """
|
|
142
|
+
# with open("bobtemplate.cfg", "w") as f:
|
|
143
|
+
# f.write(template)
|
|
144
|
+
# result = subprocess.check_output([plonecli_bin, "build"], cwd=target_path)
|
|
145
|
+
# assert u"\nRUN: python3 -m venv venv" in result.decode()
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires explicitly python3.7")
|
|
149
|
+
# def test_plonecli_build_py_option(tmpdir, plonecli_bin):
|
|
150
|
+
# target_path = tmpdir.strpath
|
|
151
|
+
# os.chdir(target_path)
|
|
152
|
+
# template = """
|
|
153
|
+
# setuptools==40.8.0
|
|
154
|
+
# zc.buildout==2.13.1
|
|
155
|
+
# """
|
|
156
|
+
# with open("requirements.txt", "w") as f:
|
|
157
|
+
# f.write(template)
|
|
158
|
+
|
|
159
|
+
# template = """[buildout]
|
|
160
|
+
# parts =
|
|
161
|
+
# """
|
|
162
|
+
# with open("buildout.cfg", "w") as f:
|
|
163
|
+
# f.write(template)
|
|
164
|
+
|
|
165
|
+
# template = """[main]
|
|
166
|
+
# version = 5.2-latest
|
|
167
|
+
# template = plone_addon
|
|
168
|
+
# python = python3
|
|
169
|
+
# """
|
|
170
|
+
# with open("bobtemplate.cfg", "w") as f:
|
|
171
|
+
# f.write(template)
|
|
172
|
+
|
|
173
|
+
# result = subprocess.check_output(
|
|
174
|
+
# [plonecli_bin, "build", "-p", "python3"], cwd=target_path,
|
|
175
|
+
# )
|
|
176
|
+
# assert u"\nRUN: python3 -m venv venv" in result.decode()
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires python3")
|
|
180
|
+
# def test_plonecli_build_py_conf(tmpdir, plonecli_bin):
|
|
181
|
+
# target_path = tmpdir.strpath
|
|
182
|
+
# os.chdir(target_path)
|
|
183
|
+
# template = """
|
|
184
|
+
# setuptools==40.8.0
|
|
185
|
+
# zc.buildout==2.13.1
|
|
186
|
+
# """
|
|
187
|
+
# with open("requirements.txt", "w") as f:
|
|
188
|
+
# f.write(template)
|
|
189
|
+
|
|
190
|
+
# template = """[buildout]
|
|
191
|
+
# parts =
|
|
192
|
+
# """
|
|
193
|
+
# with open("buildout.cfg", "w") as f:
|
|
194
|
+
# f.write(template)
|
|
195
|
+
|
|
196
|
+
# template = """[main]
|
|
197
|
+
# version = 5.2-latest
|
|
198
|
+
# template = plone_addon
|
|
199
|
+
# python = python3
|
|
200
|
+
# """
|
|
201
|
+
# with open("bobtemplate.cfg", "w") as f:
|
|
202
|
+
# f.write(template)
|
|
203
|
+
|
|
204
|
+
# result = subprocess.check_output([plonecli_bin, "build"], cwd=target_path)
|
|
205
|
+
# assert "\nRUN: python3 -m venv venv" in result.decode()
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
# @pytest.mark.skipif(sys.version_info < (3, 0), reason="requires python3")
|
|
209
|
+
# def test_plonecli_build_target_py27(tmpdir, plonecli_bin):
|
|
210
|
+
# target_path = tmpdir.strpath
|
|
211
|
+
# os.chdir(target_path)
|
|
212
|
+
# template = """
|
|
213
|
+
# setuptools==40.8.0
|
|
214
|
+
# zc.buildout==2.13.1
|
|
215
|
+
# """
|
|
216
|
+
# with open("requirements.txt", "w") as f:
|
|
217
|
+
# f.write(template)
|
|
218
|
+
|
|
219
|
+
# template = """[buildout]
|
|
220
|
+
# parts =
|
|
221
|
+
# """
|
|
222
|
+
# with open("buildout.cfg", "w") as f:
|
|
223
|
+
# f.write(template)
|
|
224
|
+
|
|
225
|
+
# template = """[main]
|
|
226
|
+
# version = 5.2.2
|
|
227
|
+
# template = plone_addon
|
|
228
|
+
# python = python2.7
|
|
229
|
+
# """
|
|
230
|
+
# with open("bobtemplate.cfg", "w") as f:
|
|
231
|
+
# f.write(template)
|
|
232
|
+
|
|
233
|
+
# result = subprocess.check_output([plonecli_bin, "build"], cwd=target_path)
|
|
234
|
+
# assert "\nRUN: virtualenv -p python2.7 venv" in result.decode()
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
"""Tests for `plonecli` package."""
|
|
4
|
+
|
|
5
|
+
from __future__ import absolute_import
|
|
6
|
+
|
|
7
|
+
from plonecli.registry import get_package_root
|
|
8
|
+
from plonecli.registry import read_bob_config
|
|
9
|
+
from plonecli.registry import TemplateRegistry
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_list_templates(tmpdir):
|
|
15
|
+
os.chdir(tmpdir.strpath)
|
|
16
|
+
reg = TemplateRegistry()
|
|
17
|
+
template_str = reg.list_templates()
|
|
18
|
+
assert "- buildout" in template_str
|
|
19
|
+
# assert "- addon" in template_str
|
|
20
|
+
assert "- theme" in template_str
|
|
21
|
+
assert "- content_type" in template_str
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# def test_get_package_root(tmpdir):
|
|
25
|
+
# target_dir = tmpdir.strpath + "/collective.foo"
|
|
26
|
+
# os.mkdir(target_dir)
|
|
27
|
+
|
|
28
|
+
# package_root = get_package_root()
|
|
29
|
+
# assert package_root is None
|
|
30
|
+
|
|
31
|
+
# os.chdir(target_dir)
|
|
32
|
+
# template = """[check-manifest]
|
|
33
|
+
# check=True
|
|
34
|
+
|
|
35
|
+
# """
|
|
36
|
+
# with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
37
|
+
# f.write(template)
|
|
38
|
+
|
|
39
|
+
# package_root = get_package_root()
|
|
40
|
+
# assert package_root is None
|
|
41
|
+
|
|
42
|
+
# # test with correct bobtemplate.cfg:
|
|
43
|
+
# template = """[check-manifest]
|
|
44
|
+
# check=True
|
|
45
|
+
|
|
46
|
+
# [main]
|
|
47
|
+
# template=plone_addon
|
|
48
|
+
# version=5.1-latest
|
|
49
|
+
# """
|
|
50
|
+
# with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
51
|
+
# f.write(template)
|
|
52
|
+
|
|
53
|
+
# package_root = get_package_root()
|
|
54
|
+
# assert package_root is not None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# def test_bob_config(tmpdir):
|
|
58
|
+
# target_dir = tmpdir.strpath + "/collective.foo"
|
|
59
|
+
# os.mkdir(target_dir)
|
|
60
|
+
# os.chdir(target_dir)
|
|
61
|
+
# template = """[main]
|
|
62
|
+
# template=plone_addon
|
|
63
|
+
# version=5.1-latest
|
|
64
|
+
# python=python2.7
|
|
65
|
+
# """
|
|
66
|
+
# with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
67
|
+
# f.write(template)
|
|
68
|
+
# reg = TemplateRegistry()
|
|
69
|
+
# bob_config = read_bob_config(reg.root_folder)
|
|
70
|
+
# assert bob_config.python == "python2.7"
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# def test_get_subtemplates(tmpdir):
|
|
74
|
+
# """test get_templates inside of a package"""
|
|
75
|
+
# template = """[check-manifest]
|
|
76
|
+
# check=True
|
|
77
|
+
|
|
78
|
+
# [main]
|
|
79
|
+
# template=plone_addon
|
|
80
|
+
# version=5.1-latest
|
|
81
|
+
# """
|
|
82
|
+
# target_dir = tmpdir.strpath + "/collective.foo"
|
|
83
|
+
# os.mkdir(target_dir)
|
|
84
|
+
# with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
85
|
+
# f.write(template)
|
|
86
|
+
# os.chdir(target_dir)
|
|
87
|
+
# reg = TemplateRegistry()
|
|
88
|
+
# templates = reg.get_templates()
|
|
89
|
+
# assert "content_type" in templates
|
|
90
|
+
# assert "theme" in templates
|
|
91
|
+
# assert "vocabulary" in templates
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# def test_get_templates(tmpdir):
|
|
95
|
+
# """test get_templates outside of a package"""
|
|
96
|
+
# os.chdir(tmpdir.strpath)
|
|
97
|
+
# reg = TemplateRegistry()
|
|
98
|
+
# templates = reg.get_templates()
|
|
99
|
+
# assert "addon" in templates
|
|
100
|
+
# assert "buildout" in templates
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
# def test_resolve_template_name(tmpdir):
|
|
104
|
+
# """test resolving template names from plonecli alias"""
|
|
105
|
+
# plonecli_alias = "addon"
|
|
106
|
+
# reg = TemplateRegistry()
|
|
107
|
+
# template_name = reg.resolve_template_name(plonecli_alias)
|
|
108
|
+
# assert "bobtemplates.plone:addon" == template_name
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
|
|
4
|
-
"""Tests for `plonecli` package."""
|
|
5
|
-
|
|
6
|
-
from __future__ import absolute_import
|
|
7
|
-
|
|
8
|
-
from click.testing import CliRunner
|
|
9
|
-
from plonecli import cli
|
|
10
|
-
|
|
11
|
-
import click
|
|
12
|
-
import os
|
|
13
|
-
import pytest
|
|
14
|
-
import subprocess
|
|
15
|
-
import sys
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@pytest.fixture
|
|
19
|
-
def response():
|
|
20
|
-
"""Sample pytest fixture.
|
|
21
|
-
|
|
22
|
-
See more at: http://doc.pytest.org/en/latest/fixture.html
|
|
23
|
-
"""
|
|
24
|
-
# import requests
|
|
25
|
-
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_content(response):
|
|
29
|
-
"""Sample pytest test function with the pytest fixture as an argument."""
|
|
30
|
-
# from bs4 import BeautifulSoup
|
|
31
|
-
# assert 'GitHub' in BeautifulSoup(response.content).title.string
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
def test_command_line_interface():
|
|
35
|
-
"""Test the CLI."""
|
|
36
|
-
runner = CliRunner()
|
|
37
|
-
result = runner.invoke(cli.cli)
|
|
38
|
-
assert result.exit_code == 0
|
|
39
|
-
# assert 'Plone Command Line Interface' in result.output
|
|
40
|
-
|
|
41
|
-
help_result = runner.invoke(cli.cli, ["--help"])
|
|
42
|
-
assert help_result.exit_code == 0
|
|
43
|
-
assert "Usage: cli" in help_result.output
|
|
44
|
-
|
|
45
|
-
help_result = runner.invoke(cli.cli, ["-h"])
|
|
46
|
-
assert help_result.exit_code == 0
|
|
47
|
-
assert "Usage: cli" in help_result.output
|
|
48
|
-
|
|
49
|
-
version_result = runner.invoke(cli.cli, ["-V"])
|
|
50
|
-
assert version_result.exit_code == 0
|
|
51
|
-
assert "Available packages:" in version_result.output
|
|
52
|
-
|
|
53
|
-
version_result = runner.invoke(cli.cli, ["--versions"])
|
|
54
|
-
assert version_result.exit_code == 0
|
|
55
|
-
assert "Available packages:" in version_result.output
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def test_plonecli_test():
|
|
59
|
-
runner = CliRunner()
|
|
60
|
-
template = """[main]
|
|
61
|
-
version = 5.1-latest
|
|
62
|
-
template = plone_addon
|
|
63
|
-
git_init = y
|
|
64
|
-
"""
|
|
65
|
-
with runner.isolated_filesystem():
|
|
66
|
-
with open("bobtemplate.cfg", "w") as f:
|
|
67
|
-
f.write(template)
|
|
68
|
-
context = click.Context(cli.run_test)
|
|
69
|
-
context.obj = {}
|
|
70
|
-
context.obj["target_dir"] = os.path.dirname(os.path.abspath("bobtemplate.cfg"))
|
|
71
|
-
|
|
72
|
-
test_command_result_a = runner.invoke(
|
|
73
|
-
cli.run_test, args=["--all"], obj=context.obj,
|
|
74
|
-
)
|
|
75
|
-
assert u"\nRUN: ./bin/test --all" in test_command_result_a.output
|
|
76
|
-
|
|
77
|
-
test_command_result_t_a = runner.invoke(
|
|
78
|
-
cli.run_test,
|
|
79
|
-
args=["-t src/collective/todo/tests/test_robot.py", "-a"],
|
|
80
|
-
obj=context.obj,
|
|
81
|
-
)
|
|
82
|
-
assert (
|
|
83
|
-
u"./bin/test --test src/collective/todo/tests/test_robot.py --all"
|
|
84
|
-
in test_command_result_t_a.output
|
|
85
|
-
) # NOQA: E501
|
|
86
|
-
|
|
87
|
-
test_command_result_s_a = runner.invoke(
|
|
88
|
-
cli.run_test, args=["-s collective.todo", "-a"], obj=context.obj,
|
|
89
|
-
)
|
|
90
|
-
assert (
|
|
91
|
-
u"./bin/test --package collective.todo --all"
|
|
92
|
-
in test_command_result_s_a.output
|
|
93
|
-
) # NOQA: E501
|
|
94
|
-
|
|
95
|
-
test_command_result_t_s = runner.invoke(
|
|
96
|
-
cli.run_test,
|
|
97
|
-
args=["-t src/collective/todo/tests/test_robot.py", "-s collective.todo"],
|
|
98
|
-
obj=context.obj,
|
|
99
|
-
)
|
|
100
|
-
assert (
|
|
101
|
-
u"./bin/test --test src/collective/todo/tests/test_robot.py --package collective.todo"
|
|
102
|
-
in test_command_result_t_s.output
|
|
103
|
-
) # NOQA: E501
|
|
104
|
-
|
|
105
|
-
test_command_result = runner.invoke(
|
|
106
|
-
cli.run_test,
|
|
107
|
-
args=[
|
|
108
|
-
"-t src/collective/todo/tests/test_robot.py",
|
|
109
|
-
"-s collective.todo",
|
|
110
|
-
"--all",
|
|
111
|
-
],
|
|
112
|
-
obj=context.obj,
|
|
113
|
-
)
|
|
114
|
-
assert (
|
|
115
|
-
u"./bin/test --test src/collective/todo/tests/test_robot.py --package collective.todo --all"
|
|
116
|
-
in test_command_result.output
|
|
117
|
-
) # NOQA: E501
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def test_plonecli_build_default_py(tmpdir, plonecli_bin):
|
|
121
|
-
target_path = tmpdir.strpath
|
|
122
|
-
os.chdir(target_path)
|
|
123
|
-
template = """
|
|
124
|
-
setuptools==40.8.0
|
|
125
|
-
zc.buildout==2.13.1
|
|
126
|
-
"""
|
|
127
|
-
with open("requirements.txt", "w") as f:
|
|
128
|
-
f.write(template)
|
|
129
|
-
|
|
130
|
-
template = """[buildout]
|
|
131
|
-
parts =
|
|
132
|
-
"""
|
|
133
|
-
with open("buildout.cfg", "w") as f:
|
|
134
|
-
f.write(template)
|
|
135
|
-
|
|
136
|
-
template = """[main]
|
|
137
|
-
version = 5.2.2
|
|
138
|
-
template = plone_addon
|
|
139
|
-
python = python3
|
|
140
|
-
git_init = y
|
|
141
|
-
"""
|
|
142
|
-
with open("bobtemplate.cfg", "w") as f:
|
|
143
|
-
f.write(template)
|
|
144
|
-
result = subprocess.check_output([plonecli_bin, "build"], cwd=target_path)
|
|
145
|
-
assert u"\nRUN: python3 -m venv venv" in result.decode()
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
@pytest.mark.skipif(sys.version_info < (3, 7), reason="requires explicitly python3.7")
|
|
149
|
-
def test_plonecli_build_py_option(tmpdir, plonecli_bin):
|
|
150
|
-
target_path = tmpdir.strpath
|
|
151
|
-
os.chdir(target_path)
|
|
152
|
-
template = """
|
|
153
|
-
setuptools==40.8.0
|
|
154
|
-
zc.buildout==2.13.1
|
|
155
|
-
"""
|
|
156
|
-
with open("requirements.txt", "w") as f:
|
|
157
|
-
f.write(template)
|
|
158
|
-
|
|
159
|
-
template = """[buildout]
|
|
160
|
-
parts =
|
|
161
|
-
"""
|
|
162
|
-
with open("buildout.cfg", "w") as f:
|
|
163
|
-
f.write(template)
|
|
164
|
-
|
|
165
|
-
template = """[main]
|
|
166
|
-
version = 5.2-latest
|
|
167
|
-
template = plone_addon
|
|
168
|
-
python = python3
|
|
169
|
-
"""
|
|
170
|
-
with open("bobtemplate.cfg", "w") as f:
|
|
171
|
-
f.write(template)
|
|
172
|
-
|
|
173
|
-
result = subprocess.check_output(
|
|
174
|
-
[plonecli_bin, "build", "-p", "python3"], cwd=target_path,
|
|
175
|
-
)
|
|
176
|
-
assert u"\nRUN: python3 -m venv venv" in result.decode()
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires python3")
|
|
180
|
-
def test_plonecli_build_py_conf(tmpdir, plonecli_bin):
|
|
181
|
-
target_path = tmpdir.strpath
|
|
182
|
-
os.chdir(target_path)
|
|
183
|
-
template = """
|
|
184
|
-
setuptools==40.8.0
|
|
185
|
-
zc.buildout==2.13.1
|
|
186
|
-
"""
|
|
187
|
-
with open("requirements.txt", "w") as f:
|
|
188
|
-
f.write(template)
|
|
189
|
-
|
|
190
|
-
template = """[buildout]
|
|
191
|
-
parts =
|
|
192
|
-
"""
|
|
193
|
-
with open("buildout.cfg", "w") as f:
|
|
194
|
-
f.write(template)
|
|
195
|
-
|
|
196
|
-
template = """[main]
|
|
197
|
-
version = 5.2-latest
|
|
198
|
-
template = plone_addon
|
|
199
|
-
python = python3
|
|
200
|
-
"""
|
|
201
|
-
with open("bobtemplate.cfg", "w") as f:
|
|
202
|
-
f.write(template)
|
|
203
|
-
|
|
204
|
-
result = subprocess.check_output([plonecli_bin, "build"], cwd=target_path)
|
|
205
|
-
assert "\nRUN: python3 -m venv venv" in result.decode()
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
@pytest.mark.skipif(sys.version_info < (3, 0), reason="requires python3")
|
|
209
|
-
def test_plonecli_build_target_py27(tmpdir, plonecli_bin):
|
|
210
|
-
target_path = tmpdir.strpath
|
|
211
|
-
os.chdir(target_path)
|
|
212
|
-
template = """
|
|
213
|
-
setuptools==40.8.0
|
|
214
|
-
zc.buildout==2.13.1
|
|
215
|
-
"""
|
|
216
|
-
with open("requirements.txt", "w") as f:
|
|
217
|
-
f.write(template)
|
|
218
|
-
|
|
219
|
-
template = """[buildout]
|
|
220
|
-
parts =
|
|
221
|
-
"""
|
|
222
|
-
with open("buildout.cfg", "w") as f:
|
|
223
|
-
f.write(template)
|
|
224
|
-
|
|
225
|
-
template = """[main]
|
|
226
|
-
version = 5.2.2
|
|
227
|
-
template = plone_addon
|
|
228
|
-
python = python2.7
|
|
229
|
-
"""
|
|
230
|
-
with open("bobtemplate.cfg", "w") as f:
|
|
231
|
-
f.write(template)
|
|
232
|
-
|
|
233
|
-
result = subprocess.check_output([plonecli_bin, "build"], cwd=target_path)
|
|
234
|
-
assert "\nRUN: virtualenv -p python2.7 venv" in result.decode()
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
|
|
3
|
-
"""Tests for `plonecli` package."""
|
|
4
|
-
|
|
5
|
-
from __future__ import absolute_import
|
|
6
|
-
|
|
7
|
-
from plonecli.registry import get_package_root
|
|
8
|
-
from plonecli.registry import read_bob_config
|
|
9
|
-
from plonecli.registry import TemplateRegistry
|
|
10
|
-
|
|
11
|
-
import os
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def test_list_templates(tmpdir):
|
|
15
|
-
os.chdir(tmpdir.strpath)
|
|
16
|
-
reg = TemplateRegistry()
|
|
17
|
-
template_str = reg.list_templates()
|
|
18
|
-
assert "- buildout" in template_str
|
|
19
|
-
assert "- addon" in template_str
|
|
20
|
-
assert "- theme" in template_str
|
|
21
|
-
assert "- content_type" in template_str
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_get_package_root(tmpdir):
|
|
25
|
-
target_dir = tmpdir.strpath + "/collective.foo"
|
|
26
|
-
os.mkdir(target_dir)
|
|
27
|
-
|
|
28
|
-
package_root = get_package_root()
|
|
29
|
-
assert package_root is None
|
|
30
|
-
|
|
31
|
-
os.chdir(target_dir)
|
|
32
|
-
template = """[check-manifest]
|
|
33
|
-
check=True
|
|
34
|
-
|
|
35
|
-
"""
|
|
36
|
-
with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
37
|
-
f.write(template)
|
|
38
|
-
|
|
39
|
-
package_root = get_package_root()
|
|
40
|
-
assert package_root is None
|
|
41
|
-
|
|
42
|
-
# test with correct bobtemplate.cfg:
|
|
43
|
-
template = """[check-manifest]
|
|
44
|
-
check=True
|
|
45
|
-
|
|
46
|
-
[main]
|
|
47
|
-
template=plone_addon
|
|
48
|
-
version=5.1-latest
|
|
49
|
-
"""
|
|
50
|
-
with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
51
|
-
f.write(template)
|
|
52
|
-
|
|
53
|
-
package_root = get_package_root()
|
|
54
|
-
assert package_root is not None
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def test_bob_config(tmpdir):
|
|
58
|
-
target_dir = tmpdir.strpath + "/collective.foo"
|
|
59
|
-
os.mkdir(target_dir)
|
|
60
|
-
os.chdir(target_dir)
|
|
61
|
-
template = """[main]
|
|
62
|
-
template=plone_addon
|
|
63
|
-
version=5.1-latest
|
|
64
|
-
python=python2.7
|
|
65
|
-
"""
|
|
66
|
-
with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
67
|
-
f.write(template)
|
|
68
|
-
reg = TemplateRegistry()
|
|
69
|
-
bob_config = read_bob_config(reg.root_folder)
|
|
70
|
-
assert bob_config.python == "python2.7"
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def test_get_subtemplates(tmpdir):
|
|
74
|
-
"""test get_templates inside of a package"""
|
|
75
|
-
template = """[check-manifest]
|
|
76
|
-
check=True
|
|
77
|
-
|
|
78
|
-
[main]
|
|
79
|
-
template=plone_addon
|
|
80
|
-
version=5.1-latest
|
|
81
|
-
"""
|
|
82
|
-
target_dir = tmpdir.strpath + "/collective.foo"
|
|
83
|
-
os.mkdir(target_dir)
|
|
84
|
-
with open(os.path.join(target_dir + "/bobtemplate.cfg"), "w") as f:
|
|
85
|
-
f.write(template)
|
|
86
|
-
os.chdir(target_dir)
|
|
87
|
-
reg = TemplateRegistry()
|
|
88
|
-
templates = reg.get_templates()
|
|
89
|
-
assert "content_type" in templates
|
|
90
|
-
assert "theme" in templates
|
|
91
|
-
assert "vocabulary" in templates
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def test_get_templates(tmpdir):
|
|
95
|
-
"""test get_templates outside of a package"""
|
|
96
|
-
os.chdir(tmpdir.strpath)
|
|
97
|
-
reg = TemplateRegistry()
|
|
98
|
-
templates = reg.get_templates()
|
|
99
|
-
assert "addon" in templates
|
|
100
|
-
assert "buildout" in templates
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
def test_resolve_template_name(tmpdir):
|
|
104
|
-
"""test resolving template names from plonecli alias"""
|
|
105
|
-
plonecli_alias = "addon"
|
|
106
|
-
reg = TemplateRegistry()
|
|
107
|
-
template_name = reg.resolve_template_name(plonecli_alias)
|
|
108
|
-
assert "bobtemplates.plone:addon" == template_name
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|