You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I too would disagree with "forcing package structure changes just to bend a package to a tool that could add intelligence to work around that instead", but src/ layouts have other advantages, and I think we want them because of those.
I found the article really interesting and investigated a little more. It seems that even among the packages we have that do have a src folder there are probably very few (None?) that correctly handle what I read as the main point: Make sure your tests run over the installed version of the package, not just the source tree.
make sure I tell buildout to not look for a stable egg by specifying versions = versions under [buildout] and adding a [versions] stanza with DocumentTemplate =
in the [test] buildout config add defaults = ['-sDocumentTemplate'] to make sure the test runner only looks for DocumentTemplate tests. This restriction is needed because the generated test script looks in the tox environment site-packages folder, which may contain other stuff.
change tox.ini to add a [coverage:paths] stanza and change [coverage:run] so source is now DocumentTemplate instead of src (this is described in https://hynek.me/articles/testing-packaging)
in tox.ini remove any skip_install = true, which prevents the installation of the egg into the tox environments
in tox.ini remove buildout:develop={toxinidir} from the buildout invocation
in tox.ini, add zope.testrunner to the deps in [testenv] - the egg path zc.recipe.testrunner embeds into bin/test wouldn't work anymore
Many of the options I needed to change are common in our packages. So making sure to "do the right thing" is a bit of work. Unless I did this the wrong way. Comments welcome.
Suggestions how to test against an installed package instead against the source for packages using
zc.buildout
intox.ini
:I found the article really interesting and investigated a little more. It seems that even among the packages we have that do have a
src
folder there are probably very few (None?) that correctly handle what I read as the main point: Make sure your tests run over the installed version of the package, not just the source tree.I looked at
DocumentTemplate
and experimented for a bit to find a combination that appears to work. Here's what else I needed to change (see https://github.com/zopefoundation/DocumentTemplate/pull/53/files):develop = .
inbuildout.cfg
versions = versions
under[buildout]
and adding a[versions]
stanza withDocumentTemplate =
[test]
buildout config adddefaults = ['-sDocumentTemplate']
to make sure the test runner only looks for DocumentTemplate tests. This restriction is needed because the generatedtest
script looks in the tox environmentsite-packages
folder, which may contain other stuff.tox.ini
to add a[coverage:paths]
stanza and change[coverage:run]
sosource
is nowDocumentTemplate
instead ofsrc
(this is described in https://hynek.me/articles/testing-packaging)tox.ini
remove anyskip_install = true
, which prevents the installation of the egg into the tox environmentstox.ini
removebuildout:develop={toxinidir}
from the buildout invocationtox.ini
, addzope.testrunner
to thedeps
in[testenv]
- the egg pathzc.recipe.testrunner
embeds intobin/test
wouldn't work anymoreMany of the options I needed to change are common in our packages. So making sure to "do the right thing" is a bit of work. Unless I did this the wrong way. Comments welcome.
Originally posted by @dataflake in zopefoundation/zc.zdaemonrecipe#3 (comment)
The text was updated successfully, but these errors were encountered: