# HG changeset patch # User David Douard # Date 1458651704 -3600 # Node ID 9d2bb6bdb5c81391d8a83b8715201ad955b7938c # Parent 4cac84a8bf5f9a9f9ca1f02146cdb11c326f60a1 [tests] add a __main__ handler the relative import in test_rest_api.py needs to be modified to prevent a ValueError: Attempted relative import in non-package diff -r 4cac84a8bf5f -r 9d2bb6bdb5c8 pyramid_cubicweb/tests/test_bw_request.py --- a/pyramid_cubicweb/tests/test_bw_request.py Tue Mar 22 13:58:38 2016 +0100 +++ b/pyramid_cubicweb/tests/test_bw_request.py Tue Mar 22 14:01:44 2016 +0100 @@ -1,4 +1,4 @@ -# -*- coding: utf8 -*- +# -*- coding: utf-8 -*- from StringIO import StringIO import webtest @@ -96,3 +96,8 @@ '/', POST=params, content_type='application/x-www-form-urlencoded')) self.assertEqual(u"é", req.form['arg']) + + +if __name__ == '__main__': + from unittest import main + main() diff -r 4cac84a8bf5f -r 9d2bb6bdb5c8 pyramid_cubicweb/tests/test_core.py --- a/pyramid_cubicweb/tests/test_core.py Tue Mar 22 13:58:38 2016 +0100 +++ b/pyramid_cubicweb/tests/test_core.py Tue Mar 22 14:01:44 2016 +0100 @@ -42,3 +42,8 @@ res = self.webapp.get('/uncommitable') self.assertEqual(res.text, 'OK') self.assertEqual(res.status_int, 200) + + +if __name__ == '__main__': + from unittest import main + main() diff -r 4cac84a8bf5f -r 9d2bb6bdb5c8 pyramid_cubicweb/tests/test_login.py --- a/pyramid_cubicweb/tests/test_login.py Tue Mar 22 13:58:38 2016 +0100 +++ b/pyramid_cubicweb/tests/test_login.py Tue Mar 22 14:01:44 2016 +0100 @@ -39,3 +39,8 @@ self.assertNotIn('auth_tkt', cookies) self.assertIn('pauth_tkt', cookies) self.assertIsNotNone(cookies['pauth_tkt'].expires) + + +if __name__ == '__main__': + from unittest import main + main() diff -r 4cac84a8bf5f -r 9d2bb6bdb5c8 pyramid_cubicweb/tests/test_rest_api.py --- a/pyramid_cubicweb/tests/test_rest_api.py Tue Mar 22 13:58:38 2016 +0100 +++ b/pyramid_cubicweb/tests/test_rest_api.py Tue Mar 22 14:01:44 2016 +0100 @@ -1,11 +1,11 @@ from __future__ import absolute_import -from . import PyramidCWTest - from pyramid_cubicweb.rest_api import EntityResource from pyramid_cubicweb.core import CubicWebPyramidRequest from pyramid.view import view_config +from pyramid_cubicweb.tests import PyramidCWTest + class RestApiTest(PyramidCWTest): def includeme(self, config): @@ -52,3 +52,8 @@ def includeme(config): config.scan(__name__) + + +if __name__ == '__main__': + from unittest import main + main() diff -r 4cac84a8bf5f -r 9d2bb6bdb5c8 pyramid_cubicweb/tests/test_tools.py --- a/pyramid_cubicweb/tests/test_tools.py Tue Mar 22 13:58:38 2016 +0100 +++ b/pyramid_cubicweb/tests/test_tools.py Tue Mar 22 14:01:44 2016 +0100 @@ -24,3 +24,8 @@ with self.admin_access.repo_cnx() as cnx: tools.cnx_attach_entity(cnx, user) self.assertEqual(user.login, 'anon') + + +if __name__ == '__main__': + from unittest import main + main()