Skip to content

Commit

Permalink
Merge pull request #14 from collective/issue-12-plone-meta
Browse files Browse the repository at this point in the history
Use pytest < 8.0, update plone/meta
  • Loading branch information
ericof authored May 15, 2024
2 parents f2bbb6c + d63a81c commit 8efbd32
Show file tree
Hide file tree
Showing 23 changed files with 89 additions and 45 deletions.
10 changes: 6 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
#
# EditorConfig Configuration file, for more details see:
Expand All @@ -13,7 +13,8 @@
root = true


[*] # For All Files
[*]
# Default settings for all files.
# Unix-style newlines with a newline ending every file
end_of_line = lf
insert_final_newline = true
Expand All @@ -29,11 +30,12 @@ max_line_length = off
# 4 space indentation
indent_size = 4

[*.{yml,zpt,pt,dtml,zcml}]
[*.{yml,zpt,pt,dtml,zcml,html,xml}]
# 2 space indentation
indent_size = 2

[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development
[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss}]
# Frontend development
# 2 space indentation
indent_size = 2
max_line_length = 80
Expand Down
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
[flake8]
doctests = 1
Expand Down
22 changes: 16 additions & 6 deletions .github/workflows/meta.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
name: Meta
on:
Expand All @@ -25,15 +25,18 @@ on:

jobs:
qa:
uses: plone/meta/.github/workflows/qa.yml@1.0.0
uses: plone/meta/.github/workflows/qa.yml@main
test:
uses: plone/meta/.github/workflows/test.yml@1.0.0
uses: plone/meta/.github/workflows/test.yml@main
with:

py-versions: '["3.11", "3.10", "3.9"]'
coverage:
uses: plone/meta/.github/workflows/coverage.yml@1.0.0
uses: plone/meta/.github/workflows/coverage.yml@main
dependencies:
uses: plone/meta/.github/workflows/dependencies.yml@1.0.0
uses: plone/meta/.github/workflows/dependencies.yml@main
release_ready:
uses: plone/meta/.github/workflows/release_ready.yml@1.0.0
uses: plone/meta/.github/workflows/release_ready.yml@main

##
# To modify the list of default jobs being created add in .meta.toml:
Expand All @@ -55,6 +58,13 @@ jobs:
# os_dependencies = "git libxml2 libxslt"
##

##
# To test against a specific matrix of python versions
# when running tests jobs, add in .meta.toml:
# [github]
# py_versions = "['3.12', '3.11']"
##


##
# Specify additional jobs in .meta.toml:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
# python related
*.egg-info
Expand Down Expand Up @@ -35,6 +35,7 @@ lib64
parts/
pyvenv.cfg
var/
local.cfg

# mxdev
/instance/
Expand Down
10 changes: 4 additions & 6 deletions .meta.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
[meta]
template = "default"
commit-id = "8c30aa23"
commit-id = "f17fd3ad"

[pyproject]
codespell_skip = "*.min.js"
codespell_ignores = "vew"
dependencies_ignores = "['plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'plone.app.testing']"
dependencies_mappings = [
"Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.ZCatalog', 'z3c.form']",
]

[tox]
use_mxdev = true
package_name = "pytest_plone"
test_runner = "pytest"
test_path = "/tests"

[github]
ref = "1.0.0"
py_versions = "[\"3.11\", \"3.10\", \"3.9\"]"
jobs = [
"qa",
"test",
Expand Down
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
ci:
autofix_prs: false
autoupdate_schedule: monthly

repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.2
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.10.1
rev: 24.4.2
hooks:
- id: black
- repo: https://github.com/collective/zpretty
Expand All @@ -32,7 +32,7 @@ repos:
# """
##
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8

Expand Down Expand Up @@ -71,7 +71,7 @@ repos:
- id: check-python-versions
args: ['--only', 'setup.py,pyproject.toml']
- repo: https://github.com/collective/i18ndude
rev: "6.1.0"
rev: "6.2.0"
hooks:
- id: i18ndude

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
**pytest-plone** is a [pytest](https://docs.pytest.org) plugin providing fixtures and helpers to test [Plone](https://plone.org) add-ons.


This package is built on top of [gocept.pytestlayer](https://github.com/gocept/gocept.pytestlayer).
This package is built on top of [zope.pytestlayer](https://github.com/zopefoundation/zope.pytestlayer).


## Reasoning
Expand Down
11 changes: 11 additions & 0 deletions dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Generated from:
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
5 changes: 0 additions & 5 deletions instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@ default_context:
initial_user_name: 'admin'
initial_user_password: 'admin'

dos_protection_form_disk_limit: "10Mb"

load_zcml:
package_includes: []

db_storage: direct
1 change: 1 addition & 0 deletions news/11.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move from `gocept.pytestlayer` to `zope.pytestlayer` [@ericof]
1 change: 1 addition & 0 deletions news/12.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pin pytest version to be lower than 8.0 [@ericof]
1 change: 1 addition & 0 deletions news/13.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update plone/meta [@ericof]
1 change: 1 addition & 0 deletions news/9.internal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Clean up dependencies for pytest-plone [@thet], [@gforcada], [@ericof]
14 changes: 10 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
[build-system]
requires = ["setuptools>=68.2"]
Expand Down Expand Up @@ -122,7 +122,6 @@ Zope = [
]
python-dateutil = ['dateutil']
ignore-packages = ['plone.volto', 'zestreleaser.towncrier', 'zest.releaser', 'pytest', 'pytest-cov', 'plone.app.testing']
Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Products.ZCatalog', 'z3c.form']

##
# Add extra configuration options in .meta.toml:
Expand All @@ -137,20 +136,27 @@ Plone = ['Products.CMFPlone', 'Products.CMFCore', 'Products.GenericSetup', 'Prod
[tool.check-manifest]
ignore = [
".editorconfig",
".flake8",
".meta.toml",
".pre-commit-config.yaml",
"tox.ini",
".flake8",
"dependabot.yml",
"mx.ini",
"tox.ini",

]

##
# Add extra configuration options in .meta.toml:
# [pyproject]
# check_manifest_ignores = """
# "*.map.js",
# "*.pyc",
# """
# check_manifest_extra_lines = """
# ignore-bad-ideas = [
# "some/test/file/PKG-INFO",
# ]
# """
##


Expand Down
15 changes: 11 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Installer for the pytest-plone package."""

from pathlib import Path
from setuptools import find_packages
from setuptools import setup
Expand Down Expand Up @@ -51,11 +52,17 @@
include_package_data=True,
zip_safe=False,
install_requires=[
"Plone",
"setuptools",
"gocept.pytestlayer",
"zope.pytestlayer",
"plone.api",
"plone.app.testing",
"pytest",
"plone.base",
"plone.browserlayer",
"plone.dexterity",
"Products.CMFPlone",
"pytest<8.0.0",
"setuptools",
"zope.component",
"zope.schema",
],
extras_require={
"test": [
Expand Down
1 change: 1 addition & 0 deletions src/pytest_plone/fixtures/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""All Fixtures."""

from .addons import browser_layers
from .addons import controlpanel_actions
from .addons import installer
Expand Down
8 changes: 5 additions & 3 deletions src/pytest_plone/fixtures/addons.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
"""Fixtures used in add-on install / uninstall tests."""

from plone import api
from plone.base.utils import get_installer
from plone.browserlayer import utils
from Products.CMFPlone.Portal import PloneSite

import pytest


@pytest.fixture
def installer(portal):
def installer(portal: PloneSite):
return get_installer(portal)


@pytest.fixture
def browser_layers(portal):
def browser_layers(portal: PloneSite):
return utils.registered_layers()


@pytest.fixture
def controlpanel_actions(portal):
def controlpanel_actions(portal: PloneSite) -> list:
controlpanel = portal.portal_controlpanel
return [a.getAction(portal)["id"] for a in controlpanel.listActions()]

Expand Down
1 change: 1 addition & 0 deletions src/pytest_plone/fixtures/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base fixtures."""

import pytest


Expand Down
1 change: 1 addition & 0 deletions src/pytest_plone/fixtures/content.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures used in content tests."""

from plone.dexterity.fti import DexterityFTI
from plone.dexterity.interfaces import IDexterityFTI
from zope.component import queryUtility
Expand Down
1 change: 1 addition & 0 deletions src/pytest_plone/fixtures/env.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Environment fixtures."""

import os
import pytest

Expand Down
1 change: 1 addition & 0 deletions src/pytest_plone/fixtures/vocabularies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Fixtures used to test vocabularies."""

from zope.component import getUtility
from zope.schema.interfaces import IVocabularyFactory
from zope.schema.vocabulary import SimpleVocabulary
Expand Down
4 changes: 2 additions & 2 deletions src/pytest_plone/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import gocept.pytestlayer.fixture
import zope.pytestlayer.fixture


def fixtures_factory(test_layers):
fixtures = {}
for item, prefix in test_layers:
fixtures.update(
gocept.pytestlayer.fixture.create(
zope.pytestlayer.fixture.create(
item,
session_fixture_name=f"{prefix}_session",
class_fixture_name=f"{prefix}_class",
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Generated from:
# https://github.com/plone/meta/tree/master/config/default
# https://github.com/plone/meta/tree/main/config/default
# See the inline comments on how to expand/tweak this configuration file
[tox]
# We need 4.4.0 for constrain_package_deps.
Expand Down Expand Up @@ -74,7 +74,7 @@ description = check if the package defines all its dependencies
skip_install = true
deps =
build
z3c.dependencychecker==2.11
z3c.dependencychecker==2.14.3
commands =
python -m build --sdist
dependencychecker
Expand Down Expand Up @@ -186,6 +186,9 @@ commands =
description = ensure there are no cyclic dependencies
use_develop = true
skip_install = false
# Here we must always constrain the package deps to what is already installed,
# otherwise we simply get the latest from PyPI, which may not work.
constrain_package_deps = true
set_env =

##
Expand Down

0 comments on commit 8efbd32

Please sign in to comment.