In order to use Senaite LIMS API, the Doctests instructions indicate that the bin/test test_textual_doctests -t API command must be run. The bin directory created for Senaite LIMS contains: backup, buildout, instance, plonectl, repozo, restore, snapshotbackup, snapshotrestore, and zopepy. Is this ‘bin’ directory where I should be looking to find ‘test’. Any insight would be appreciated.
You need to add the “test” part in the the buildout file (buildout.cfg, probably) and run bin/buildout afterwards (see Unit testing — Plone Documentation v5.2).
parts =
...
test
[test]
recipe = zc.recipe.testrunner
defaults = ['--auto-color', '--auto-progress']
eggs =
senaite.core [test]
I have found two versions of the test command to run:
bin/test test_textual_doctests -t API
bin/test test_doctests -t API
The first yields:
Total: 0 tests, 0 failures, 0 errors in 0.000 seconds.
The second yields:
Test-module import failures:
Module: senaite.api.tests.test_doctests
Traceback (most recent call last):
File “/home/senaite/buildout-cache/eggs/senaite.api-1.2.0-py2.7.egg/senaite/api/tests/test_doctests.py”, line 7, in
import unittest2 as unittest
ImportError: No module named unittest2
Test-modules with import problems:
senaite.api.tests.test_doctests
Total: 0 tests, 0 failures, 0 errors in 0.000 seconds.
I’ve tried to pip install unittest2, but that did not resolve the error.
pip install won’t affect what packages are available for Plone. Those will need to be added to your buildout.cfg file.
I haven’t dug around with the test suite itself, but my guess is what you are looking for is adding unittest2 to your buildout eggs list in the [buildout] section.
eggs =
Plone
Pillow
Products.PloneHotfix20200121
senaite.core
senaite.lims
senaite.impress
senaite.jsonapi
unittest2 #Add this line
It looks like the newest version is compatible with python2.7, but if they release a python3+ version in the future, then you might need to pin the version down at the bottom under the [versions] section.
[versions]
unittest2 = 1.1.0 #This line may be necessary in the future
isort = 4.0.0
Pillow = 5.1.0
cssselect2 = 0.2.2
soupsieve = 1.9.5
importlib-resources = 3.3.1
buildout.sanitycheck = 1.0.2
collective.recipe.backup = 4.1.0
plone.recipe.unifiedinstaller = 5.2b1
Products.PloneHotfix20200121 = 1.1
Thank you for your response. I used this method already and received this error:
Test-module import failures:
Module: senaite.api.tests.test_doctests
Traceback (most recent call last):
File “/home/senaite/buildout-cache/eggs/senaite.api-1.2.0-py2.7.egg/senaite/api/tests/test_doctests.py”, line 11, in
from .base import SimpleTestCase
File “/home/senaite/buildout-cache/eggs/senaite.api-1.2.0-py2.7.egg/senaite/api/tests/base.py”, line 5, in
from plone.testing import z2
ImportError: No module named testing
Test-modules with import problems:
senaite.api.tests.test_doctests
Total: 0 tests, 0 failures, 0 errors in 0.000 seconds.
Adding ‘testing’ to the eggs list in the [buildout] section does not resolve this error.
Hm. Well, now I need help in turn! in order to try and mimic this issue I started from scratch, followed installation instructions from senaite.com, I had some issues:
I had to use 4.3.19, because 4.3.20 (latest) is not available on plone.org (it’s just… not).
Buildout refused to download senaite.lims-135 for me; no matter if I updated the index value, updated to new pypi index url and findlinks, set PYTHONHTTPSVERIFY… it won’t do it.
That’s fine, I manually installed these and their dependencies as develop eggs.
Alright, senaite.lims requires Plone 4.3.20. Edit setup.py to reset the pin to 4.3.19…
When the required cssselect2 (0.3.0) told me that it no longer supports Python2, I thought I’d take a break.
Remove senaite.api, is an obsolete package (its repos is archived, actually). System will install and work just fine without. Yes, you have to stick to Plone 4.3.20 if you install senaite.lims 1.3.5 (this LTS version was released two days ago), look at the dependencies: senaite.lims/setup.py at 1.3.5 · senaite/senaite.lims · GitHub
I received a number of command prompts after executing bin/test test_textual_doctests -t API, excerpting the last few sentences:
“Ran 8 tests with 0 failures, 0 errors, 0 skipped in 21.372 seconds.
Tearing down left over layers:
Tear down senaite.core.tests.layers.SENAITE:BaseTesting in 0.000 seconds.
Tear down senaite.core.tests.layers.BaseLayer in 0.005 seconds.
Tear down plone.app.testing.layers.PloneFixture in 0.032 seconds.
Tear down plone.testing.zope.Startup in 0.005 seconds.
Tear down plone.testing.zca.LayerCleanup in 0.002 seconds.”
There is no procedure as described in the test documentation:
"API
The purpose of this API is to help coders to follow the DRY principle (Don’t Repeat Yourself). It also ensures that the most effective and efficient method is used to achieve a task.
Import it first: