summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech.siewierski@onet.pl>2019-01-27 03:25:10 +0100
committerWojciech Siewierski <wojciech.siewierski@onet.pl>2019-01-27 03:36:50 +0100
commit9d82571b55bde833d0937e5625d0bc778807561a (patch)
tree45723eb59737ebfce1c7b49ec9b17134a1ae6532
parentcab56031ccee7091d940a477b2269cd8e2210002 (diff)
downloadranger-9d82571b55bde833d0937e5625d0bc778807561a.tar.gz
doctests are no longer silently failing (when failing)
Related issue: #1457

See: https://stackoverflow.com/a/25691978
-rw-r--r--Makefile3
-rw-r--r--ranger/api/commands.py3
-rw-r--r--ranger/ext/direction.py3
-rw-r--r--ranger/ext/human_readable.py3
-rw-r--r--ranger/ext/iter_tools.py3
-rw-r--r--ranger/ext/keybinding_parser.py2
-rw-r--r--ranger/ext/lazy_property.py3
-rwxr-xr-xranger/ext/rifle.py2
-rw-r--r--ranger/ext/signals.py3
-rw-r--r--ranger/ext/widestring.py2
-rw-r--r--ranger/gui/ansi.py3
-rw-r--r--ranger/gui/widgets/console.py3
12 files changed, 21 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 6e27c482..c6b3b35d 100644
--- a/Makefile
+++ b/Makefile
@@ -98,7 +98,8 @@ test_flake8:
 
 test_doctest:
 	@echo "Running doctests..."
-	@for FILE in $(shell grep -IHm 1 doctest -r ranger | grep $(FILTER) | cut -d: -f1); do \
+	@set -e; \
+	for FILE in $(shell grep -IHm 1 doctest -r ranger | grep $(FILTER) | cut -d: -f1); do \
 		echo "Testing $$FILE..."; \
 		RANGER_DOCTEST=1 PYTHONPATH=".:"$$PYTHONPATH ${PYTHON} $$FILE; \
 	done
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 9c687927..90a79488 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -448,4 +448,5 @@ def command_function_factory(func):
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py
index 33ebb604..32b69954 100644
--- a/ranger/ext/direction.py
+++ b/ranger/ext/direction.py
@@ -174,4 +174,5 @@ class Direction(dict):
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py
index 385e56f4..6541989e 100644
--- a/ranger/ext/human_readable.py
+++ b/ranger/ext/human_readable.py
@@ -56,4 +56,5 @@ def human_readable(byte, separator=' '):  # pylint: disable=too-many-return-stat
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/iter_tools.py b/ranger/ext/iter_tools.py
index f321aee0..c710fbba 100644
--- a/ranger/ext/iter_tools.py
+++ b/ranger/ext/iter_tools.py
@@ -47,4 +47,5 @@ def unique(iterable):
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py
index e5fb6a86..8703d458 100644
--- a/ranger/ext/keybinding_parser.py
+++ b/ranger/ext/keybinding_parser.py
@@ -278,4 +278,4 @@ class KeyBuffer(object):  # pylint: disable=too-many-instance-attributes
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/lazy_property.py b/ranger/ext/lazy_property.py
index bb54bd5e..42b61979 100644
--- a/ranger/ext/lazy_property.py
+++ b/ranger/ext/lazy_property.py
@@ -59,4 +59,5 @@ class lazy_property(object):  # pylint: disable=invalid-name,too-few-public-meth
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 377f9b8a..ad7d0049 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -534,6 +534,6 @@ def main():  # pylint: disable=too-many-locals
 if __name__ == '__main__':
     if 'RANGER_DOCTEST' in os.environ:
         import doctest
-        doctest.testmod()
+        sys.exit(doctest.testmod()[0])
     else:
         main()
diff --git a/ranger/ext/signals.py b/ranger/ext/signals.py
index 67c8960d..0973249c 100644
--- a/ranger/ext/signals.py
+++ b/ranger/ext/signals.py
@@ -278,4 +278,5 @@ class SignalDispatcher(object):
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py
index 2721643c..390da639 100644
--- a/ranger/ext/widestring.py
+++ b/ranger/ext/widestring.py
@@ -164,4 +164,4 @@ class WideString(object):  # pylint: disable=too-few-public-methods
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py
index ff8b2fd9..ce735317 100644
--- a/ranger/gui/ansi.py
+++ b/ranger/gui/ansi.py
@@ -175,4 +175,5 @@ def char_slice(ansi_text, start, length):
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 13201e34..d796058c 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -530,4 +530,5 @@ class Console(Widget):  # pylint: disable=too-many-instance-attributes,too-many-
 
 if __name__ == '__main__':
     import doctest
-    doctest.testmod()
+    import sys
+    sys.exit(doctest.testmod()[0])