Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to set setenv. #91

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions config/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ updated. Example:
testenv-deps = [
"zope.testrunner",
]
testenv-setenv = [
"ZOPE_INTERFACE_STRICT_IRO=1",
]
testenv-additional = [
"setenv =",
" ZOPE_INTERFACE_STRICT_IRO=1",
"passenv =",
" DISPLAY",
]
coverage-command = "coverage run {envbindir}/test_with_gs []"
coverage-setenv = [
Expand Down Expand Up @@ -365,6 +368,11 @@ testenv-deps
This option has to be a list of strings without indentation. The default is
``['zope.testrunner']``.

testenv-setenv
Set the value of the ``setenv`` option in ``[testenv]`` of ``tox.ini``.
Depending in the template used this might be an addition to the predefined
values for this option. This option has to be a list of strings.

testenv-additional
Additional lines for the section ``[testenv]`` in ``tox.ini``.
This option has to be a list of strings.
Expand Down
2 changes: 2 additions & 0 deletions config/config-package.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ def copy_with_meta(template_name, destination, config_type, **kw):
'testenv-additional-extras', [])
testenv_commands_pre = meta_cfg['tox'].get('testenv-commands-pre', [])
testenv_commands = meta_cfg['tox'].get('testenv-commands', [])
testenv_setenv = meta_cfg['tox'].get('testenv-setenv', [])
coverage_command = meta_cfg['tox'].get('coverage-command', '')
testenv_deps = meta_cfg['tox'].get('testenv-deps', ['zope.testrunner'])
coverage_setenv = meta_cfg['tox'].get('coverage-setenv', [])
Expand All @@ -238,6 +239,7 @@ def copy_with_meta(template_name, destination, config_type, **kw):
testenv_commands_pre=testenv_commands_pre,
testenv_commands=testenv_commands,
testenv_deps=testenv_deps,
testenv_setenv=testenv_setenv,
flake8_additional_sources=flake8_additional_sources,
coverage_command=coverage_command,
coverage_setenv=coverage_setenv,
Expand Down
6 changes: 6 additions & 0 deletions config/default/tox-testenv.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ deps =
{% for line in testenv_deps %}
%(line)s
{% endfor %}
{% if testenv_setenv %}
setenv =
{% for line in testenv_setenv %}
%(line)s
{% endfor %}
{% endif %}
{% if testenv_commands_pre %}
commands_pre =
{% for line in testenv_commands_pre %}
Expand Down
6 changes: 6 additions & 0 deletions config/zope-product/tox.ini.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ skip_install = true
deps =
setuptools < 52
zc.buildout
{% if testenv_setenv %}
setenv =
{% for line in testenv_setenv %}
%(line)s
{% endfor %}
{% endif %}
commands_pre =
{% if testenv_commands_pre %}
{% for line in testenv_commands_pre %}
Expand Down