Commit 826042a9 authored by Jérome Perrin's avatar Jérome Perrin

slapos.cookbook/testing: fix missing version pin for mock

Because we run egg tests with setup.py test, which installs missing
eggs, if an egg was not installed by buildout, then it installed before
running test. This was the case for mock, which is now python3 only (
https://pypi.org/project/mock/4.0.0b1/ ) and we started to see test
failures.

To solve this issue, refactor the setup definition to use
extra_requires, which seems to work fine in buildout now. Keep
test_requires because it's the what `python setup.py test` uses.

Clean buildout profiles to install slapos.cookbook[test] for test
instead of duplicating the content of test_requires.

/reviewed-on !690
parent 78605aef
Pipeline #7777 running with stage
......@@ -36,8 +36,14 @@ long_description = open("README.rst").read() + "\n" + \
for f in sorted(glob.glob(os.path.join('slapos', 'recipe', 'README.*.rst'))):
long_description += '\n' + open(f).read() + '\n'
# extras_requires are not used because of
# https://bugs.launchpad.net/zc.buildout/+bug/85604
extras_require = {
'test': (
'jsonschema',
'mock',
'testfixtures',
),
}
setup(name=name,
version=version,
description="SlapOS recipes.",
......@@ -201,10 +207,7 @@ setup(name=name,
'kumo = slapos.recipe.nosqltestbed.kumo:KumoTestBed',
],
},
extras_require=extras_require,
test_suite='slapos.test',
tests_require=[
'jsonschema',
'mock',
'testfixtures',
],
tests_require=extras_require['test'],
)
......@@ -24,7 +24,7 @@ recipe = zc.recipe.egg:develop
[slapos.cookbook-setup]
<= setup-develop-egg
egg = slapos.cookbook
egg = slapos.cookbook[test]
setup = ${slapos-repository:location}/
[slapos.test.caddy-frontend-setup]
......@@ -210,3 +210,6 @@ Django = 1.11
urllib3 = 1.24.1
backports.lzma = 0.0.13
mock = 2.0.0
testfixtures = 6.11
......@@ -55,14 +55,13 @@ depends = ${slapos.core-setup:egg}
[slapos.cookbook-setup]
<= setup-develop-egg
# XXX slapos.cookbook does not have `test` extra require, `mock` is only listed in `tests_require` and is listed explicitly
egg = slapos.cookbook
egg = slapos.cookbook[test]
setup = ${slapos.cookbook-repository:location}
depends = ${slapos.core-setup:egg}
[slapos.core-setup]
<= setup-develop-egg
# XXX slapos.cookbook does not have `test` extra require, `mock`, `pyflakes` and `httmock` are only listed in `tests_require` and are listed explicitly
# XXX slapos.core does not have `test` extra require, `mock`, `pyflakes` and `httmock` are only listed in `tests_require` and are listed explicitly
egg = slapos.core
setup = ${slapos.core-repository:location}
......@@ -201,12 +200,13 @@ gitdb2 = 2.0.4
httmock = 1.2.6
manuel = 1.9.0
mock = 2.0.0
testfixtures = 6.11.0
pem = 18.1.0
pycurl = 7.43.0.2
pyflakes = 2.0.0
smmap2 = 2.0.4
zope.testing = 4.6.2
urllib3 = 1.24.1
urllib3 = 1.24.1
# Required by:
# caucase
PyJWT = 1.6.4
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