diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-21 18:01:44 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-21 18:01:44 -0400 |
commit | 029e0a23c0c9a357014c9586ead34df23f3363eb (patch) | |
tree | 44311ecb9a5185b9ac2a65c69ccd490c052f5405 | |
parent | 6d6651caac7a57aead3d4551afe2a3f9a84cfb49 (diff) | |
parent | 3e085fdee07d65054a246a857a3e0f8816a738de (diff) | |
download | cmd2-git-029e0a23c0c9a357014c9586ead34df23f3363eb.tar.gz |
Merge branch 'master' into new_quoted_completion
-rw-r--r-- | tests/test_argparse.py | 13 | ||||
-rw-r--r-- | tests/test_completion.py | 14 |
2 files changed, 25 insertions, 2 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py index fb8836f3..ae3bde98 100644 --- a/tests/test_argparse.py +++ b/tests/test_argparse.py @@ -5,7 +5,6 @@ Cmd2 testing for argument parsing import argparse import functools import pytest -import readline import sys import cmd2 @@ -14,6 +13,18 @@ import six from conftest import run_cmd, StdOut +# Prefer statically linked gnureadline if available (for macOS compatibility due to issues with libedit) +try: + import gnureadline as readline +except ImportError: + # Try to import readline, but allow failure for convenience in Windows unit testing + # Note: If this actually fails, you should install readline on Linux or Mac or pyreadline on Windows + try: + # noinspection PyUnresolvedReferences + import readline + except ImportError: + pass + class ArgparseApp(cmd2.Cmd): def __init__(self): diff --git a/tests/test_completion.py b/tests/test_completion.py index f6fd5fdc..8af39ae8 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -10,7 +10,6 @@ Released under MIT license, see LICENSE file """ import argparse import os -import readline import sys import cmd2 @@ -19,6 +18,19 @@ import pytest from cmd2 import path_complete, basic_complete, flag_based_complete, index_based_complete +# Prefer statically linked gnureadline if available (for macOS compatibility due to issues with libedit) +try: + import gnureadline as readline +except ImportError: + # Try to import readline, but allow failure for convenience in Windows unit testing + # Note: If this actually fails, you should install readline on Linux or Mac or pyreadline on Windows + try: + # noinspection PyUnresolvedReferences + import readline + except ImportError: + pass + + @pytest.fixture def cmd2_app(): c = cmd2.Cmd() |