diff --git a/test/Dockerfile b/test/Dockerfile index af7ee932205084a5aeaec512b3143f07ca5e87e6..e615d056d98b4753f2b99154268af66367001a78 100644 --- a/test/Dockerfile +++ b/test/Dockerfile @@ -1,12 +1,9 @@ FROM registry.git.autistici.org/ai3/float:integration-test -RUN apt-get -q update && env DEBIAN_FRONTEND=noninteractive \ - apt-get install --no-install-recommends -y python python-pip python-setuptools python-yaml python-nose - ADD . /config WORKDIR /config -RUN python setup.py install +RUN python3 setup.py install ENV TEST_CONFIG=/test-config.yml ENV PYTHONPATH=/src -CMD ["nosetests", "-v", "ai3test"] +CMD ["nosetests3", "-v", "ai3test"] diff --git a/test/README.md b/test/README.md index c94a3b327e2afa61002c48e058c687120a441b43..4d522fa8ae6784c07536d5e04f9432c36e20d65c 100644 --- a/test/README.md +++ b/test/README.md @@ -7,18 +7,18 @@ Per testare l'ambiente locale di test di ai3 (Vagrant), bisogna prima installare alcuni prerequisiti. Anzitutto serve *virtualenv*, per es. su una macchina Debian: - $ sudo apt-get install python-virtualenv + $ sudo apt install python3-virtualenv Dopodiché bisogna creare una directory *venv* con un'installazione locale di Python (per evitare di "sporcare" il sistema con le dipendenze della suite di test): - $ virtualenv venv + $ virtualenv --python python3 venv Infine bisogna installare la test suite dentro questo ambiente Python temporaneo: - $ ./venv/bin/python setup.py develop + $ ./venv/bin/python3 setup.py develop # Test @@ -33,4 +33,4 @@ esempio, per testare l'ambiente locale Vagrant di default: L'integrazione con 'float' avviene tramite un playbook apposito (ai3-test): - $ ANSIBLE_STDOUT_CALLBACK=minimal ../../float/float run ../../rules/playbooks/ai3-test.yml + $ ANSIBLE_STDOUT_CALLBACK=minimal ../../float/float run ../../config/playbooks/ai3-test.yml diff --git a/test/ai3test/test_web_users.py b/test/ai3test/test_web_users.py index 50991ab47b5e7bc92746e97b4f6e8954e44a0cd2..ec528f37d4adb9cd7399ce7bd476bdb57538e247 100644 --- a/test/ai3test/test_web_users.py +++ b/test/ai3test/test_web_users.py @@ -1,4 +1,4 @@ -import urllib2 +import urllib.request, urllib.error, urllib.parse from ai3test import AI3_TEST_PARAMS, ANSIBLE_VARS, TestBase, request @@ -16,7 +16,7 @@ class WebUsersBase(TestBase): endpoint, ANSIBLE_VARS['domain_public'][0], path) handlers = [] if username and password: - h = urllib2.HTTPBasicAuthHandler() + h = urllib.request.HTTPBasicAuthHandler() h.add_password('', '/', username, password) handlers.append(h) result = request(url, self.frontend_ip(), handlers=handlers) @@ -48,4 +48,4 @@ class SubsiteTest(WebUsersBase): url = 'https://www.%s/%s' % ( ANSIBLE_VARS['domain_public'][0], username) result = request(url, self.frontend_ip()) - self.assertEquals(result['location'], url + '/') + self.assertEqual(result['location'], url + '/') diff --git a/test/setup.py b/test/setup.py index 0a3fbe0ba26b3140322044eb8d2c73ad3bc69bcc..8c125ad15698f63ea1a4f8e8dd1d68d4aaf8556e 100644 --- a/test/setup.py +++ b/test/setup.py @@ -1,5 +1,3 @@ -#!/usr/bin/python - from setuptools import setup, find_packages setup( diff --git a/test/tox.ini b/test/tox.ini index 2ae49045be4145da222232df9f3828c71480c63d..26af0a07b058faec1a1b1c035df3abbf3334ae61 100644 --- a/test/tox.ini +++ b/test/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27 +envlist = py3 [testenv] passenv = TEST_CONFIG