Skip to content

Add @pytest.mark.portal marker support (#37)#42

Merged
ericof merged 5 commits intomainfrom
issue-37-portal-marker
Apr 16, 2026
Merged

Add @pytest.mark.portal marker support (#37)#42
ericof merged 5 commits intomainfrom
issue-37-portal-marker

Conversation

@ericof
Copy link
Copy Markdown
Member

@ericof ericof commented Apr 12, 2026

Summary

  • Add @pytest.mark.portal marker that lets tests declare GenericSetup profiles, content, and roles inline — without overriding the portal fixture
  • Add apply_profiles session-scoped fixture to apply GenericSetup profiles
  • Add create_content session-scoped fixture to create content items as the site owner
  • Add grant_roles session-scoped fixture to grant local roles to the test user
  • Document all new fixtures and the marker in README.md

Closes #37

Example

@pytest.mark.portal(
    profiles=["my.addon:testing"],
    content=[{"type": "Document", "id": "doc1", "title": "Doc 1"}],
    roles=["Manager"],
)
def test_something(portal):
    assert "doc1" in portal

Housekeeping

  • Bump Plone version to 6.1.4
  • Add plone-stubs to test dependencies
  • Update VS Code settings (remove obsolete flake8 config, add plone-stubs paths)

Test plan

  • Existing tests without the marker pass unchanged (backwards-compatible)
  • Tests with roles parameter grant roles to the test user
  • Tests with content parameter create content in the portal
  • Tests with profiles parameter apply GenericSetup profiles
  • Combined marker parameters work together
  • Marker setup doesn't leak between tests (integration layer rollback)

ericof added 5 commits April 12, 2026 12:15
Introduce a portal marker that lets tests declare GenericSetup profiles,
content, and roles inline — without overriding the portal fixture.

New session-scoped fixtures: apply_profiles, create_content, grant_roles.

Also: bump Plone to 6.1.4, add plone-stubs to test deps, update mx.ini.
- actions/checkout v4 → v6, astral-sh/setup-uv v5 → v8.0.0
- Use setup-uv built-in caching instead of actions/cache
- Skip venv creation in Makefile when .venv already exists (setup-uv)
- Run mypy via uvx to avoid full install in lint job
- Add fail-fast: false to test matrix
- Fix cookiecutter template variable left in Makefile
plone-stubs is not published on PyPI, so reference it directly from
GitHub. Remove it from mx.ini (no marker support) and use a PEP 508
direct reference in pyproject.toml instead.
@ericof ericof merged commit 71c686d into main Apr 16, 2026
12 checks passed
@ericof ericof deleted the issue-37-portal-marker branch April 16, 2026 13:22
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.

Add @pytest.mark.portal marker support

1 participant