summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-15 13:28:48 -0700
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-15 13:28:48 -0700
commit1d66e283490d5ef5ad03597f3f8d42e87e371550 (patch)
tree7bc7995e3a9fea42bc3061c42b7d02e2d3e7a87a /tests/test_cmd2.py
parenta6b5733a94eaaf42c5b113de64fced3ea807c91e (diff)
downloadcmd2-git-1d66e283490d5ef5ad03597f3f8d42e87e371550.tar.gz
Add back in use of 3rd-party mock module for Python 3.5
Apparently there were some issues in the unitest.mock module in Python 3.5 (but not 3.4 or 3.6)
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 2da75f93..04498c49 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -6,20 +6,22 @@ Copyright 2016 Federico Ceratto <federico.ceratto@gmail.com>
Released under MIT license, see LICENSE file
"""
import argparse
+from code import InteractiveConsole
import os
import sys
import io
import tempfile
-from unittest import mock
import pytest
import six
-
-from code import InteractiveConsole
-
-# Used for sm.input: raw_input() for Python 2 or input() for Python 3
import six.moves as sm
+# Python 3.5 had some regressions in the unitest.mock module, so use 3rd party mock if available
+try:
+ import mock
+except ImportError:
+ from unittest import mock
+
import cmd2
from conftest import run_cmd, normalize, BASE_HELP, BASE_HELP_VERBOSE, \
HELP_HISTORY, SHORTCUTS_TXT, SHOW_TXT, SHOW_LONG, StdOut