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

POC: use mxdev #931

Draft
wants to merge 16 commits into
base: 6.1
Choose a base branch
from
Draft

POC: use mxdev #931

wants to merge 16 commits into from

Conversation

mauritsvanrees
Copy link
Sponsor Member

@mauritsvanrees mauritsvanrees commented May 15, 2024

This uses the bin/manage buildout2pip command from plone/plone.releaser#72 to create mxsources.txt and mxcheckouts.txt from the Buildout sources and checkouts. Then we add some more files to use this, and update the Makefile:

$ make help
clean                          Remove old virtualenv and creates a new one
help                           This help message
mxdev-generate                 mxdev: generate requirements and constraints files without pulling sources
mxdev-update                   mxdev: update requirements and constraints files and pull the sources
pip-bootstrap                  Pip: Bootstrap a venv for tests (future: several venvs with less installed)
pip-test                       Pip: Run only a few unit tests, as proof of concept.
pip-update                     Pip: Update a venv for tests (future: several venvs with less installed)
test-acceptance                Run acceptance tests
test                           Run tests

The Makefile targets starting with pip or mxdev are new.

Usage would be:

# Create/refresh the mxdev sources and checkouts (you need to use the `plone.releaser` branch from the linked PR (I committed the result):
bin/manage buildout2pip
# Create venvs/test/ installing `uv` and `mxdev`:
make pip-bootstrap
# Use mxdev to (re)generate requirements and constraints files:
make mxdev-generate
# Instead, you can call `make mxdev-update` to do the same plus pull the packages that should be checked out.
# Install all packages, which includes test packages: 
make pip-update
# Run the real unit tests (without any layers) of CMFPlone:
make pip-test

Some points of interest:

  • make pip-test will need lots of changes before it can be a replacement of bin/test.
  • Bug in mxdev: it does not comment out Plone and Products.CMFPlone from the constraints, probably because they have capital letters. I made a manual change in constraints-mxdiv.txt to work around this. I created an issue in mxdev.
  • At some point I would want multiple venvs without the test dependencies: one with only pip install Products.CMFPlone, with with Plone, one with plone.volto, and one with plone.classicui. Tricky is that the Plone package is always in the checkouts, so we would always have -e src/Plone, making it hard to have a venv with only Products.CMFPlone. But the single venv with everything including test dependencies seems fine as a start.
  • We do not generate any wsgi and zope.conf files, like cookieplone or other generators would do. That is for later. But maybe the ones generated by Buildout are fine for now.

… packages.

This uses `uv` for speed.

pip-bootstrap                  Pip: Bootstrap a venv for tests (future: several venvs with less installed)
pip-test                       Pip: Run only a few unit tests, as proof of concept.
pip-update                     Pip: Update a venv for tests (future: several venvs with less installed)
Created by: `./venvs/test/bin/mxdev -c mxdev.ini -n`
mxdev should do this, but I think it fails because these packages have capital letters.
Same would be true for Zope, but we do not notice at this moment, because it is not pinned in the versions.cfg of Zope master.
Otherwise the CMFPlone tests are not found when CMFPlone is an editable install.

Adding `--path src` does not work.  You get this error:

```
ModuleNotFoundError: No module named 'Products.CMFPlone.Products'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants