Skip to content

Commit

Permalink
Travis --> Github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
xispa committed Jun 13, 2024
1 parent 7a5c993 commit 64d4bcb
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 239 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: build and test senaite.ast
on:
- push
- pull_request
env:
PLONE_VERSION: "5.2"
jobs:
build-and-test:
runs-on: 'ubuntu-20.04'
container:
image: python:2.7.18-buster
steps:
- uses: actions/checkout@v3
- name: cache eggs
uses: actions/cache@v3
with:
key: eggs-cache-${{ hashFiles('buildout.cfg', 'requirements.txt') }}
path: |
eggs/
- name: install
run: |
pip install virtualenv
virtualenv -p `which python` .
bin/pip install --upgrade pip
bin/pip install -r requirements.txt
bin/buildout -N -t 3 annotate
bin/buildout -N -t 3
- name: test
run: |
bin/test -s senaite.ast.tests
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Antibiotic Sensitivity Testing (AST) for SENAITE
.. image:: https://img.shields.io/pypi/v/senaite.ast.svg?style=flat-square
:target: https://pypi.python.org/pypi/senaite.ast

.. image:: https://img.shields.io/travis/com/senaite/senaite.ast/master.svg?style=flat-square
:target: https://app.travis-ci.com/github/senaite/senaite.ast
.. image:: https://img.shields.io/github/actions/workflow/status/senaite/senaite.ast/build-and-test.yml?branch=2.x
:target: https://github.com/senaite/senaite.ast/actions/workflows/build-and-test.yml?query=branch:2.x

.. image:: https://readthedocs.org/projects/pip/badge/
:target: https://senaiteast.readthedocs.org
Expand Down
95 changes: 4 additions & 91 deletions buildout.cfg
Original file line number Diff line number Diff line change
@@ -1,105 +1,18 @@
[buildout]
index = https://pypi.org/simple/
extends = https://dist.plone.org/release/5.2-latest/versions.cfg
find-links =
https://dist.plone.org/release/5.2-latest/
https://dist.plone.org/thirdparty/
extends = https://raw.githubusercontent.com/senaite/senaite.core/2.x/buildout.cfg

package-name = senaite.ast

parts =
instance
test
omelette
i18ndude
zopepy
update_translations
write_code_headers

eggs =
senaite.core
senaite.app.listing
senaite.app.spotlight
senaite.app.supermodel
senaite.impress
senaite.jsonapi
senaite.lims
senaite.abx
senaite.microorganism
senaite.ast
plone.reload
Products.PrintingMailHost

extensions = mr.developer

package-name = senaite.ast

versions = versions
show-picked-versions = true

plone-user = admin:admin

develop = .
sources = sources
auto-checkout = *

[sources]
senaite.core = git https://github.com/senaite/senaite.core.git branch=2.x
senaite.app.listing = git https://github.com/senaite/senaite.app.listing.git branch=2.x
senaite.app.spotlight = git https://github.com/senaite/senaite.app.spotlight.git branch=2.x
senaite.app.supermodel = git https://github.com/senaite/senaite.app.supermodel.git branch=2.x
senaite.impress = git https://github.com/senaite/senaite.impress.git branch=2.x
senaite.jsonapi = git https://github.com/senaite/senaite.jsonapi.git branch=2.x
senaite.lims = git https://github.com/senaite/senaite.lims.git branch=2.x
senaite.abx = git https://github.com/senaite/senaite.abx.git
senaite.microorganism = git https://github.com/senaite/senaite.microorganism.git

[instance]
recipe = plone.recipe.zope2instance
http-address = 127.0.0.1:8080
user = ${buildout:plone-user}
wsgi = on
eggs =
Plone
plone.app.upgrade
${buildout:package-name}
${buildout:eggs}
deprecation-warnings = on
environment-vars =
zope_i18n_compile_mo_files true
zcml =

[i18ndude]
unzip = true
recipe = zc.recipe.egg
eggs = i18ndude

[update_translations]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/update_translations
input = ${buildout:directory}/templates/update_translations.in
mode = 755

[write_code_headers]
recipe = collective.recipe.template
output = ${buildout:directory}/bin/write_code_headers
input = ${buildout:directory}/templates/write_code_headers.py.in
mode = 755
senaite.core = git https://github.com/senaite/senaite.core.git

[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
eggs =
senaite.ast [test]

[omelette]
recipe = collective.recipe.omelette
eggs = ${buildout:eggs}

[zopepy]
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = zopepy
scripts = zopepy

[versions]
setuptools =
zc.buildout =
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
setuptools==42.0.2
setuptools==44.1.1
zc.buildout==2.13.3
wheel
64 changes: 39 additions & 25 deletions src/senaite/ast/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,45 @@
# Copyright 2020-2024 by it's authors.
# Some rights reserved, see README and LICENSE.

from plone.app.testing import TEST_USER_ID
from plone.app.testing import setRoles
from plone.app.testing.bbb_at import PloneTestCase
from plone.protect.authenticator import createToken
from senaite.ast.tests.layers import BASE_TESTING
import transaction
from plone.app.testing import applyProfile
from plone.app.testing import FunctionalTesting
from plone.testing import zope
from senaite.core.tests.base import BaseTestCase
from senaite.core.tests.layers import BaseLayer


class BaseTestCase(PloneTestCase):
"""Use for test cases which do not rely on the demo data
class SimpleTestLayer(BaseLayer):

def setUpZope(self, app, configurationContext):
super(SimpleTestLayer, self).setUpZope(app, configurationContext)

# Load ZCML
import senaite.abx
import senaite.microorganism
self.loadZCML(package=senaite.abx)
self.loadZCML(package=senaite.microorganism)
self.loadZCML(package=senaite.ast)

# Install product and call its initialize() function
zope.installProduct(app, "senaite.abx")
zope.installProduct(app, "senaite.microorganism")
zope.installProduct(app, "senaite.ast")

def setUpPloneSite(self, portal):
super(SimpleTestLayer, self).setUpPloneSite(portal)
applyProfile(portal, "senaite.ast:default")
transaction.commit()


SIMPLE_TEST_LAYER_FIXTURE = SimpleTestLayer()
SIMPLE_TESTING = FunctionalTesting(
bases=(SIMPLE_TEST_LAYER_FIXTURE, ),
name="senaite.ast:SimpleTesting"
)


class SimpleTestCase(BaseTestCase):
"""Use for test cases which do not rely on demo data
"""
layer = BASE_TESTING

def setUp(self):
super(BaseTestCase, self).setUp()
# Fixing CSRF protection
# https://github.com/plone/plone.protect/#fixing-csrf-protection-failures-in-tests
self.request = self.layer["request"]
# Disable plone.protect for these tests
self.request.form["_authenticator"] = createToken()
# Eventuelly you find this also useful
self.request.environ["REQUEST_METHOD"] = "POST"

setRoles(self.portal, TEST_USER_ID, ["LabManager", "Manager"])

# Default skin is set to "Sunburst Theme"!
# => This causes an `AttributeError` when we want to access
# e.g. 'guard_handler' FSPythonScript
self.portal.changeSkin("Plone Default")
layer = SIMPLE_TESTING
75 changes: 0 additions & 75 deletions src/senaite/ast/tests/layers.py

This file was deleted.

4 changes: 2 additions & 2 deletions src/senaite/ast/tests/test_doctests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import unittest2 as unittest
from senaite.ast import PRODUCT_NAME
from senaite.ast.tests.base import BaseTestCase
from senaite.ast.tests.base import SimpleTestCase
from Testing import ZopeTestCase as ztc

# Option flags for doctests
Expand All @@ -38,7 +38,7 @@ def test_suite():
suite.addTests([
ztc.ZopeDocFileSuite(
doctestfile,
test_class=BaseTestCase,
test_class=SimpleTestCase,
optionflags=flags
)
])
Expand Down
22 changes: 0 additions & 22 deletions travis.cfg

This file was deleted.

0 comments on commit 64d4bcb

Please sign in to comment.