Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
9951a251
Commit
9951a251
authored
4 years ago
by
Nathan Hertz
Browse files
Options
Downloads
Patches
Plain Diff
Added new buildout recipe for testing buildout recipes.
parent
414eb326
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build/recipes/test_recipes/setup.py
+8
-0
8 additions, 0 deletions
build/recipes/test_recipes/setup.py
build/recipes/test_recipes/test_recipes.py
+58
-0
58 additions, 0 deletions
build/recipes/test_recipes/test_recipes.py
buildout.cfg
+5
-1
5 additions, 1 deletion
buildout.cfg
with
71 additions
and
1 deletion
build/recipes/test_recipes/setup.py
0 → 100644
+
8
−
0
View file @
9951a251
from
setuptools
import
setup
setup
(
name
=
'
test_recipes
'
,
version
=
'
0.1
'
,
py_modules
=
[
'
test_recipes
'
],
entry_points
=
{
"
zc.buildout
"
:
[
"
default=test_recipes:Recipe
"
]},
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
build/recipes/test_recipes/test_recipes.py
0 → 100644
+
58
−
0
View file @
9951a251
import
subprocess
import
logging
logger
=
logging
.
getLogger
(
"
buildout/test_recipes
"
)
def
get_recipes
():
"""
Get all currently installed buildout recipes (including this one!)
:return: Dictionary with format {recipe_name: recipe_path_from_root,}
"""
logger
.
debug
(
"
Getting list of recipes...
"
)
recipes
=
{}
find
=
subprocess
.
run
([
'
find
'
,
'
./build/recipes
'
,
'
-name
'
,
'
setup.py
'
],
stdout
=
subprocess
.
PIPE
)
paths
=
find
.
stdout
.
decode
(
'
utf-8
'
).
split
(
'
\n
'
)
dirs
=
[]
names
=
[]
for
p
in
paths
:
if
len
(
p
)
>
1
:
# Exclude empty result from find
dirs
.
append
(
p
.
replace
(
'
/setup.py
'
,
''
))
names
.
append
(
p
.
split
(
'
/
'
)[
-
2
])
for
d
,
n
in
zip
(
dirs
,
names
):
recipes
[
n
]
=
d
logger
.
debug
(
"
Done getting recipes.
"
)
return
recipes
class
Recipe
:
"""
Buildout Recipe class.
For more detailed information, see the link.
http://www.buildout.org/en/latest/topics/writing-recipes.html
"""
def
__init__
(
self
,
buildout
,
name
,
options
):
"""
Initializes fields needed for recipe.
:param buildout: (Boilerplate) Dictionary of options from buildout section
of buildout.cfg
:param name: (Boilerplate) Name of section that uses this recipe.
:param options: (Boilerplate) Options of section that uses this recipe.
"""
self
.
name
=
name
self
.
options
=
options
self
.
recipes
=
get_recipes
()
self
.
choice
=
options
[
'
name
'
]
def
install
(
self
):
"""
Install method that runs when recipe has components it needs to install.
In this case, nothing is
"
installed
"
per se.
:return: Paths to files, as strings, created by the recipe.
"""
if
self
.
choice
in
self
.
recipes
:
logger
.
debug
(
f
"
Running tests for recipe
{
self
.
choice
}
...
"
)
subprocess
.
run
([
'
pytest
'
,
'
-vv
'
,
'
--log-level=DEBUG
'
,
'
--showlocals
'
,
self
.
recipes
[
self
.
choice
]])
This diff is collapsed.
Click to expand it.
buildout.cfg
+
5
−
1
View file @
9951a251
...
...
@@ -3,7 +3,11 @@
# e.g. buildout parts=build_pkgs will specify build_pkgs
# as a part that should be installed
[buildout]
develop
=
build/recipes/setup_to_meta build/recipes/build_pkgs
develop
=
build/recipes/setup_to_meta build/recipes/build_pkgs build/recipes/test_recipes
[test]
recipe
=
test_recipes
name
=
${buildout:name}
# Section for building internal tools using conda
# Depends on gen_metadata
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment