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