author | David Douard <david.douard@logilab.fr> |
Tue, 19 Jul 2016 19:30:10 +0200 | |
branch | 3.22 |
changeset 11438 | 828483a88825 |
parent 10940 | 343a43503018 |
permissions | -rw-r--r-- |
10887
a0315e9f4c20
[tests] Don't import QUnitTestCase into tests' global namespace
Rémi Cardona <remi.cardona@logilab.fr>
parents:
8930
diff
changeset
|
1 |
from cubicweb.devtools import qunit |
a0315e9f4c20
[tests] Don't import QUnitTestCase into tests' global namespace
Rémi Cardona <remi.cardona@logilab.fr>
parents:
8930
diff
changeset
|
2 |
|
5742
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
3 |
|
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
4 |
def js(name): |
10935
049209b9e9d6
[qunit] stop dealing with filesystem paths
Rémi Cardona <remi.cardona@logilab.fr>, Julien Cristau <julien.cristau@logilab.fr>
parents:
10887
diff
changeset
|
5 |
return '/static/js_examples/' + name |
5742
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
6 |
|
10887
a0315e9f4c20
[tests] Don't import QUnitTestCase into tests' global namespace
Rémi Cardona <remi.cardona@logilab.fr>
parents:
8930
diff
changeset
|
7 |
class QUnitTestCaseTC(qunit.QUnitTestCase): |
5742
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
8 |
|
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
9 |
all_js_tests = ( |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
10 |
(js('test_simple_success.js'),), |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
11 |
(js('test_with_dep.js'), (js('dep_1.js'),)), |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
12 |
(js('test_with_ordered_deps.js'), (js('dep_1.js'), js('deps_2.js'),)), |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
13 |
) |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
14 |
|
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
15 |
|
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
16 |
def test_simple_failure(self): |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
17 |
js_tests = list(self._test_qunit(js('test_simple_failure.js'))) |
6340
470d8e828fda
[test] update test to unittest2 api (still using lgc.testlib though)
Sylvain Thénault <sylvain.thenault@logilab.fr>
parents:
5742
diff
changeset
|
18 |
self.assertEqual(len(js_tests), 3) |
5742
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
19 |
test_1, test_2, test_3 = js_tests |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
20 |
self.assertRaises(self.failureException, test_1[0], *test_1[1:]) |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
21 |
self.assertRaises(self.failureException, test_2[0], *test_2[1:]) |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
22 |
test_3[0](*test_3[1:]) |
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
23 |
|
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
24 |
|
74c19dac29cf
Add a QUnitTestCase class to run qunit test case.
Pierre-Yves David <pierre-yves.david@logilab.fr>
parents:
diff
changeset
|
25 |
if __name__ == '__main__': |
10887
a0315e9f4c20
[tests] Don't import QUnitTestCase into tests' global namespace
Rémi Cardona <remi.cardona@logilab.fr>
parents:
8930
diff
changeset
|
26 |
from unittest import main |
a0315e9f4c20
[tests] Don't import QUnitTestCase into tests' global namespace
Rémi Cardona <remi.cardona@logilab.fr>
parents:
8930
diff
changeset
|
27 |
main() |