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

Fix tests for python2 in branch 7.x.x #1721

Merged
merged 22 commits into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 54 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,8 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.7, 3.6, 2.7]
plone-version: [5.2, 5.1, 4.3]
exclude:
- python-version: 3.6
plone-version: 4.3
- python-version: 3.6
plone-version: 5.0
- python-version: 3.6
plone-version: 5.1
- python-version: 3.7
plone-version: 4.3
- python-version: 3.7
plone-version: 5.0
- python-version: 3.7
plone-version: 5.1
- python-version: 3.8
plone-version: 4.3
- python-version: 3.8
plone-version: 5.0
- python-version: 3.8
plone-version: 5.1
python-version: [3.8, 3.7]
plone-version: [5.2]

steps:
# git checkout
Expand All @@ -42,7 +23,7 @@ jobs:
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

Expand All @@ -64,7 +45,7 @@ jobs:

# build sphinx
- name: sphinx
run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.7' ]; then bin/sphinxbuilder; fi
run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.8' ]; then bin/sphinxbuilder; fi

# test
- name: test
Expand All @@ -79,4 +60,53 @@ jobs:

# test sphinx warnings
- name: sphinx
run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.7' ]; then bin/test-no-sphinx-warnings; fi
run: if [ "${{ matrix.plone-version }}" == "5.2" ] && [ ${{ matrix.python-version }} == '3.8' ]; then bin/test-no-sphinx-warnings; fi

build-py2:
runs-on: ubuntu-20.04
container:
image: python:2.7.18-buster
strategy:
fail-fast: false
matrix:
python-version: [2.7]
plone-version: [5.2, 5.1, 4.3]

steps:
# git checkout
- uses: actions/checkout@v2

# python cache
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

# python install
- run: pip install virtualenv
- run: pip install wheel
- name: pip install
run: pip install -r requirements.txt

# buildout
- name: buildout
run: buildout -t 10 -c plone-${{ matrix.plone-version }}.x.cfg code-analysis:return-status-codes=True
env:
CI: true

# code analysis
- name: code analysis
run: bin/code-analysis

# test
- name: test
run: bin/test

# test no uncommited changes
- name: test no uncommited changes
run: bin/test-no-uncommitted-doc-changes
env:
PYTHON_VERSION: ${{ matrix.python-version }}
PLONE_VERSION: ${{ matrix.plone-version }}
2 changes: 2 additions & 0 deletions news/1721.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
New version pins to run tests
[erral]
6 changes: 6 additions & 0 deletions plone-4.3.x.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,9 @@ six = 1.12.0

# latest version compatible with Python 2
plone.schema = 1.4.0

# latest version compatible with Python 2
sphinxcontrib-websupport = 1.1.2
stdlib-list = 0.6.0
zest.pocompile = 1.6.0
plone.rest = 3.0.2
3 changes: 3 additions & 0 deletions plone-5.1.x.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ pyparsing = 2.4.7

# Required by plone.restapi
six = 1.12.0
stdlib-list = 0.6.0
zest.pocompile= 1.6.0
plone.rest = 3.0.2
1 change: 1 addition & 0 deletions plone-5.2.x.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ importlib-metadata = 2.0.0

# latest version compatible with Python 2
flake8-print = 4.0.1
zest.pocompile= 1.6.0
14 changes: 10 additions & 4 deletions src/plone/restapi/tests/test_dxfield_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ def setUp(self):
]

def serialize(self, fieldname, value):
field = None
for schema in iterSchemata(self.doc1):
if fieldname in schema:
field = schema.get(fieldname)
break
dm = getMultiAdapter((self.doc1, field), IDataManager)
dm.set(value)
serializer = getMultiAdapter((field, self.doc1, self.request), IFieldSerializer)
return serializer()
if field is not None:
dm = getMultiAdapter((self.doc1, field), IDataManager)
dm.set(value)
serializer = getMultiAdapter(
(field, self.doc1, self.request), IFieldSerializer
)
return serializer()

return None

def test_ascii_field_serialization_returns_unicode(self):
value = self.serialize("test_ascii_field", "foo")
Expand Down
6 changes: 3 additions & 3 deletions test-no-uncommitted-doc-changes.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ function red {
echo "$RED $1 $RESET"
}

if [ "$PLONE_VERSION" == "5.2" ] && [ "$PYTHON_VERSION" == '3.7' ]; then
echo "Running check for undocumented changes for Plone 5.2.x on Python 3.7"
if [ "$PLONE_VERSION" == "5.2" ] && [ "$PYTHON_VERSION" == '3.8' ]; then
echo "Running check for undocumented changes for Plone 5.2.x on Python 3.8"
else
# request/response dumps have known differences for Plone 5
# => skip, we can't have the Plone 5 build fail because of those
echo "Skipping checks for undocumented changes for everything except Plone 5.2.x on Python 3.7"
echo "Skipping checks for undocumented changes for everything except Plone 5.2.x on Python 3.8"
exit 0
fi

Expand Down
Loading