summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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.py10
-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, 28 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..848f4255 100644
--- a/ranger/ext/human_readable.py
+++ b/ranger/ext/human_readable.py
@@ -55,5 +55,13 @@ def human_readable(byte, separator=' '):  # pylint: disable=too-many-return-stat
 
 
 if __name__ == '__main__':
+
+    # XXX: This mock class is a temporary (as of 2019-01-27) hack.
+    class SettingsAwareMock(object):  # pylint: disable=too-few-public-methods
+        class settings(object):  # pylint: disable=invalid-name,too-few-public-methods
+            size_in_bytes = False
+    SettingsAware = SettingsAwareMock  # noqa: F811
+
     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])