diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 827fa303..9abf07a3 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -14,10 +14,10 @@ jobs: fail-fast: false matrix: include: - - python: "2.7" - plone: "4.3" - - python: "3.8" - plone: "5.2" +# - python: "2.7.18" +# plone: "4.3" +# - python: "3.8" +# plone: "5.2" - python: "3.10" plone: "6.0" services: @@ -31,11 +31,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Set up pyenv and Python - uses: "gabrielfalcao/pyenv-action@v14" - with: - default: "${{ matrix.python }}" - command: pyenv -v - name: Setup Env run: | mkdir -p -m 777 /tmp/appy/ @@ -44,86 +39,85 @@ jobs: sudo apt-get install -qq -y libreoffice libreoffice-script-provider-python sudo apt-get autoremove -qq -y sudo apt-get autoclean -qq -y - mkdir -p buildout-cache/{eggs,downloads} - pip install -r requirements-${{ matrix.plone }}.txt - - name: Checkout - uses: actions/checkout@v2 - - name: Cache eggs - uses: actions/cache@v2 - env: - cache-name: cache-eggs +# mkdir -p buildout-cache/{eggs,downloads} + - name: Set up pyenv and Python + uses: "gabrielfalcao/pyenv-action@v16" with: - path: ~/buildout-cache/eggs - key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.plone }} - restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.plone }} + default: "${{ matrix.python }}" + command: pip install -U pip + - name: Install dependencies + run: pip install -r requirements-${{ matrix.plone }}.txt +# - name: Cache eggs +# uses: actions/cache@v2 +# env: +# cache-name: cache-eggs +# with: +# path: ~/.buildout/eggs +# key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.plone }} +# restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.plone }} - name: buildout run: | - sed -ie "s#plone-5#plone-${{matrix.plone}}#" test-ci.cfg - buildout -c test-ci.cfg annotate - buildout -c test-ci.cfg - - name: code-analysis - run: | - bin/code-analysis + buildout -c test_plone${{ matrix.plone }}.cfg -v + buildout annotate - name: test run: | - docker ps -a + cat bin/test + pwd bin/test --test=\!"robot" - coverage: - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - matrix: - include: - - python: "3.10" - plone: "6.0" - services: - libreoffice: - image: imiobe/libreoffice:7.3 - ports: - - 2002:2002 - volumes: - - /tmp:/tmp - - /var/tmp:/var/tmp - steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Setup Env - run: | - mkdir -p -m 777 /tmp/appy/ - sudo add-apt-repository ppa:libreoffice/ppa -y - sudo apt update -qq -y - sudo apt-get install -qq -y libreoffice libreoffice-script-provider-python - sudo apt-get autoremove -qq -y - sudo apt-get autoclean -qq -y - mkdir -p buildout-cache/{eggs,downloads} - - pip install -r requirements-${{ matrix.plone }}.txt - - name: Checkout - uses: actions/checkout@v2 - - name: Cache eggs - uses: actions/cache@v2 - env: - cache-name: cache-eggs - with: - path: ~/buildout-cache/eggs - key: ${{ runner.os }}-coverage-${{ env.cache-name }}-${{ matrix.plone }} - restore-keys: ${{ runner.os }}-coverage-${{ env.cache-name }}-${{ matrix.plone }} - - name: buildout - run: | - sed -ie "s#plone-5#plone-${{matrix.plone}}#" test-ci.cfg - pip install -r requirements.txt coverage==5.3.1 - buildout -c test-ci.cfg annotate - buildout -c test-ci.cfg - bin/translation-manage -c - - name: test coverage - run: | - bin/coverage run bin/test --test=\!"robot" - - name: Install Coveralls - run: | - pip install -U pip setuptools --no-cache-dir - pip install -U "coveralls>=3.0.0" coverage==5.3.1 --no-cache-dir - - name: Publish to Coveralls - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - coveralls --service=github +# coverage: +# runs-on: ubuntu-22.04 +# strategy: +# fail-fast: false +# matrix: +# include: +# - python: "3.10" +# plone: "6.0" +# services: +# libreoffice: +# image: imiobe/libreoffice:7.3 +# ports: +# - 2002:2002 +# volumes: +# - /tmp:/tmp +# - /var/tmp:/var/tmp +# steps: +# - name: Checkout +# uses: actions/checkout@v3 +# - name: Setup Env +# run: | +# mkdir -p -m 777 /tmp/appy/ +# sudo add-apt-repository ppa:libreoffice/ppa -y +# sudo apt update -qq -y +# sudo apt-get install -qq -y libreoffice libreoffice-script-provider-python +# sudo apt-get autoremove -qq -y +# sudo apt-get autoclean -qq -y +# mkdir -p buildout-cache/{eggs,downloads} +# +# pip install -r requirements-${{ matrix.plone }}.txt +# - name: Cache eggs +# uses: actions/cache@v2 +# env: +# cache-name: cache-eggs +# with: +# path: ~/buildout-cache/eggs +# key: ${{ runner.os }}-coverage-${{ env.cache-name }}-${{ matrix.plone }} +# restore-keys: ${{ runner.os }}-coverage-${{ env.cache-name }}-${{ matrix.plone }} +# - name: buildout +# run: | +# cp test_plone${{ matrix.plone }}.cfg buildout.cfg +# pip install -r requirements.txt coverage==5.3.1 +# buildout -c ci.cfg annotate +# buildout -c ci.cfg +# bin/translation-manage -c +# - name: test coverage +# run: | +# bin/coverage run bin/test --test=\!"robot" +# - name: Install Coveralls +# run: | +# pip install -U pip setuptools --no-cache-dir +# pip install -U "coveralls>=3.0.0" coverage==5.3.1 --no-cache-dir +# - name: Publish to Coveralls +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# run: | +# coveralls --service=github diff --git a/buildout.d/base.cfg b/base.cfg similarity index 100% rename from buildout.d/base.cfg rename to base.cfg diff --git a/buildout.cfg b/buildout.cfg index d0bb7c6d..ff01ab50 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -1,5 +1,36 @@ [buildout] extends = - buildout.d/plone-6.0.x.cfg -# buildout.d/plone-5.2.x.cfg -# buildout.d/plone-4.3.x.cfg + https://raw.github.com/collective/buildout.plonetest/master/test-6.0.x.cfg + development.cfg + +auto-checkout += + plone.restapi + +[sources] +collective.excelexport = git ${remotes:collective}/collective.excelexport.git pushurl=${remotes:collective_push}/collective.excelexport.git branch=plone6 +appy = git ${remotes:imio}/appy.git pushurl=${remotes:imio_push}/appy.git branch=python3 +plone.restapi = git ${remotes:plone}/plone.restapi.git pushurl=${remotes:plone_push}/plone.restapi.git branch=main +imio.helpers = git ${remotes:imio}/imio.helpers.git pushurl=${remotes:imio_push}/imio.helpers.git branch=plone6 + +[versions] +appy = +# to keep prompt-toolkit < 3 +ipython = 8.3.0 + +ipdb = 0.13.9 +iw.debug = 0.3 +jedi = 0.18.1 +parso = 0.8.3 + +# Required by: +# ipdb +asttokens = 2.0.8 +backcall = 0.2.0 +executing = 1.1.1 +matplotlib-inline = 0.1.6 +pexpect = 4.8.0 +pickleshare = 0.7.5 +ptyprocess = 0.7.0 +pure-eval = 0.2.2 +stack-data = 0.5.1 +traitlets = 5.4.0 \ No newline at end of file diff --git a/ci.cfg b/ci.cfg new file mode 100644 index 00000000..113cd036 --- /dev/null +++ b/ci.cfg @@ -0,0 +1,10 @@ +[buildout] +extends = + buildout.cfg + +parts += + createcoverage + +[createcoverage] +recipe = zc.recipe.egg +eggs = createcoverage \ No newline at end of file diff --git a/buildout.d/development.cfg b/development.cfg similarity index 100% rename from buildout.d/development.cfg rename to development.cfg diff --git a/src/collective/documentgenerator/DX_renderer.py b/src/collective/documentgenerator/DX_renderer.py index 18dff72d..a2e54aea 100644 --- a/src/collective/documentgenerator/DX_renderer.py +++ b/src/collective/documentgenerator/DX_renderer.py @@ -35,7 +35,7 @@ def render_value(self): """Format the date.""" value = self.exportable.render_value(self.context) plone = getMultiAdapter((self.context, self.request), name=u'plone') - if type(value) == datetime.date: + if isinstance(value, datetime.date): value = datetime.datetime(value.year, value.month, value.day) return plone.toLocalizedTime(value) diff --git a/src/collective/documentgenerator/helper/base.py b/src/collective/documentgenerator/helper/base.py index 8975ea5b..d68771c7 100644 --- a/src/collective/documentgenerator/helper/base.py +++ b/src/collective/documentgenerator/helper/base.py @@ -52,7 +52,7 @@ def display_date(self, field_name=None, date=None, long_format=None, time_only=N if date is None: return u'' - if type(date) == datetime.date: + if isinstance(date, datetime.date): date = datetime.datetime(date.year, date.month, date.day) return ulocalized_time(date, long_format=long_format, time_only=time_only, custom_format=custom_format, diff --git a/test-ci.cfg b/test-ci.cfg deleted file mode 100644 index 98b77017..00000000 --- a/test-ci.cfg +++ /dev/null @@ -1,14 +0,0 @@ -[buildout] -extends = - buildout.d/plone-5.x.cfg - -eggs-directory = ~/buildout-cache/eggs - -package-name = collective.documentgenerator -package-extras = [test] - -allow-hosts += - *.org - -[code-analysis] -pre-commit-hook = False diff --git a/buildout.d/plone-4.3.x.cfg b/test_plone4.3.cfg similarity index 100% rename from buildout.d/plone-4.3.x.cfg rename to test_plone4.3.cfg diff --git a/buildout.d/plone-5.2.x.cfg b/test_plone5.2.cfg similarity index 100% rename from buildout.d/plone-5.2.x.cfg rename to test_plone5.2.cfg diff --git a/buildout.d/plone-6.0.x.cfg b/test_plone6.0.cfg similarity index 100% rename from buildout.d/plone-6.0.x.cfg rename to test_plone6.0.cfg