Commit 662b1a0b authored by Kirill Smelkov's avatar Kirill Smelkov

pygolang: Add way to run tests

- Add pygolang/buildout-dev.cfg that overrides [pygolang] to use the
  software from git checkout.

- Add pygolang/test.cfg that is software-release to create a test
  instance to be run under testnode. This software release uses
  just-added stack/nxdtest.cfg to help itself on this task, so the code
  in pygolang is minimal.

A new section [python-interpreter] is added, because python interpreters
that zc.recipe.egg generates don't process `-m args` correctly and
handle subprocess well. I had to workaround that with code from
gpython.pymain to be able to run `python -m pytest --<pytestarg>` and to
spawn children processes with preserving sys.path. Comments around and
inside [python-interpreter] has more details on this topic.
parent 97527e35
# SlapOS component for pygolang development.
[buildout]
extends =
buildout.cfg
../git/buildout.cfg
# override pygolang to install it from latest git version
[pygolang]
recipe = zc.recipe.egg:develop
setup = ${pygolang-repository:location}
[pygolang-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/nexedi/pygolang.git
branch = master
location = ${buildout:parts-directory}/pygolang-dev
git-executable = ${git:location}/bin/git
# unpin pygolang from versions, so that buildout does not fallback to
# installing non-dev egg if dev one has changed its version.
[versions]
pygolang =
......@@ -27,6 +27,31 @@ scripts = gpython
# convenience for gpython users
exe = ${buildout:bin-directory}/gpython
# python-interpreter provides python interpreter with all specified eggs.
# eggs default to pygolang, but can be overwritten or changed in inherited section.
# if eggs are changes, they must still have pygolang.
[python-interpreter]
recipe = zc.recipe.egg:scripts
eggs = ${pygolang:egg}
interpreter = python
# interpreter code that buildout generates cannot process `-m pytest --<pytest-option>`
# -> use pymain from gpython to workaround that.
initialization =
# set sys.executable to self, so that subprocess and friends go through us
# and this way spawn children with correct sys.path where all eggs that
# parent have are present. TODO consider migrating this into pymain
sys.executable = sys.argv[0]
# tail to pymain
from gpython import pymain
pymain(sys.argv[1:])
sys.exit(0)
# don't install scripts from listed eggs (avoid conflict with other sections
# that use zc.recipe.egg with eggs overlapping with ${:eggs} - ex neoppod)
# (we cannot use zc.recipe.egg:eggs because interpreter does not work there)
# NOTE with scripts=ø interpreter is not handled, so we use `scripts=python` as
# a workaround.
scripts = ${:interpreter}
[versions]
pygolang = 0.0.7.post1
......
# SlapOS software release to test pygolang on Nexedi testing infrastructure.
[buildout]
extends =
../../stack/nxdtest.cfg
../pytest/buildout.cfg
buildout-dev.cfg
parts =
pygolang
gpython
pygolang-python
# for instance
slapos-cookbook
instance.cfg
# tune pygolang to install with all and for-tests extras.
[pygolang]
egg = pygolang[all_test]
# bin/python is preinstalled with sys.path to pygolang & friends.
[pygolang-python]
<= python-interpreter
eggs = ${pygolang:egg}
# env.sh for pygolang's python/gpython to be on $PATH.
[pygolang-env.sh]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/${:_buildout_section_name_}
template = inline:
export PS1="(pygolang-env) $PS1"
export PATH=${buildout:bin-directory}:$PATH
# instance to run nxdtest.
[instance.cfg]
<= jinja2-template
template = inline:
[buildout]
extends = ${nxdtest-instance.cfg:rendered}
[runTestSuite]
env.sh = ${pygolang-env.sh:rendered}
workdir = ${pygolang-repository:location}
[versions]
numpy = 1.16.6
ipython = 5.10.0
ipython-genutils = 0.2.0
traitlets = 4.3.3
simplegeneric = 0.8.1
Pygments = 2.5.2
prompt-toolkit = 1.0.18
pickleshare = 0.7.5
pexpect = 4.8.0
backports.shutil-get-terminal-size = 1.0.0
ptyprocess = 0.6.0
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment