1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-22 00:02:28 +00:00

Run tests from gsiupm/senpy

This commit is contained in:
J. Fernando Sánchez 2017-07-12 17:50:09 +02:00
parent 9bea267f52
commit 9870391088
2 changed files with 10 additions and 1 deletions

View File

@ -70,8 +70,13 @@ dev: dev-$(PYMAIN)
test-all: $(addprefix test-,$(PYVERSIONS))
# Run setup.py from in an isolated container, built from the base image.
# This speeds tests up because the image has most (if not all) of the dependencies already.
test-%:
docker run --rm --entrypoint /usr/local/bin/python -v $(PWD):/usr/src/app -w /usr/src/app $(IMAGENAME):python$* setup.py test
docker rm $(NAME)-test-$* || true
docker create -ti --name $(NAME)-test-$* --entrypoint="" -w /usr/src/app/ $(IMAGENAME):python$* python setup.py test
docker cp . $(NAME)-test-$*:/usr/src/app
docker start -a $(NAME)-test-$*
test: test-$(PYMAIN)

View File

@ -69,6 +69,10 @@ class Plugin(models.Plugin):
pass
def test(self):
if not hasattr(self, 'test_cases'):
import inspect
raise AttributeError(('Plugin {} [{}] does not have any defined '
'test cases').format(self.id, inspect.getfile(self.__class__)))
for case in self.test_cases:
res = list(self.analyse_entry(models.Entry(case['entry']),
case['params']))