[PATCH 2 of 2 logilab-doctools] Test: add test configuration & fix failing tests

Nsukami Patrick ptrck at nskm.xyz
Mon Sep 9 18:26:00 CEST 2019


# HG changeset patch
# User Nsukami Patrick <ptrck at nskm dot xyz>
# Date 1568046293 0
#      Mon Sep 09 16:24:53 2019 +0000
# Node ID 77b35768d70685d645fba5c52b0ed4432840b22e
# Parent  89244325ba4bde96063a12e58becfc3c1d72a7d5
Test: add test configuration & fix failing tests

- add basic tox.ini
- install dev reqs from dev-requirements.txt file
- make sure all tests are executed & remove useless file
- fix failing tests

diff --git a/dev-requirements.txt b/dev-requirements.txt
new file mode 100644
--- /dev/null
+++ b/dev-requirements.txt
@@ -0,0 +1,2 @@
+pytest
+pygments
diff --git a/test/runtests.py b/test/runtests.py
deleted file mode 100644
--- a/test/runtests.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from logilab.common.testlib import main
-
-if __name__ == '__main__':
-    import sys, os
-    main(os.path.dirname(sys.argv[0]) or '.')
diff --git a/test/unittest_transformer.py b/test/unittest_transformer.py
--- a/test/unittest_transformer.py
+++ b/test/unittest_transformer.py
@@ -17,16 +17,16 @@
         self.assertEqual(guess_format('machin.rest'), 'rest')
 
     def test_known_values_4(self):
-        self.assertEqual(guess_format('machin.xml'), 'docbook')
+        self.assertEqual(guess_format('test/machin.xml'), 'docbook')
 
     def test_known_values_5(self):
-        self.assertEqual(guess_format('machin.dbk'), 'docbook')
+        self.assertEqual(guess_format('test/machin.dbk'), 'docbook')
 
     def test_known_values_6(self):
         self.assertEqual(guess_format('machin.fo'), 'fo')
 
     def test_known_values_6(self):
-        self.assertEqual(guess_format('bill.xml'), 'pybill')
+        self.assertEqual(guess_format('test/bill.xml'), 'pybill')
 
     def test_raise_1(self):
         self.assertRaises(InputGuessException, guess_format, 'machin.unk')
diff --git a/tox.ini b/tox.ini
new file mode 100644
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,13 @@
+[tox]
+envlist=py27
+
+[testenv]
+deps =
+  -rdev-requirements.txt
+commands =
+  {envpython} -m pytest {posargs}
+
+[pytest]
+python_files = *test*.py
+testpaths = test
+addopts = -r fEs



More information about the cubicweb-devel mailing list