Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions pyrepl/curses.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

from __future__ import absolute_import
# Copyright 2000-2010 Michael Hudson-Doyle <[email protected]>
# Armin Rigo
#
Expand All @@ -19,5 +19,8 @@
# CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.


from ._minimal_curses import setupterm, tigetstr, tparm, error
# First try the built-in module
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also mention that the builtin is only expected to be there with PyPy probably.

try:
from _minimal_curses import setupterm, tigetstr, tparm, error
except ImportError:
from ._minimal_curses import setupterm, tigetstr, tparm, error
7 changes: 5 additions & 2 deletions testing/test_curses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pytest
from pyrepl.curses import setupterm
try:
from pyrepl.curses import setupterm, error as curses_error
except ImportError:
pytest.skip('cannot import curses', allow_module_level=True)
import pyrepl


Expand All @@ -17,7 +20,7 @@ def test_setupterm(monkeypatch):

monkeypatch.delenv('TERM')
with pytest.raises(
pyrepl._minimal_curses.error,
curses_error,
match=r"setupterm\(None, 0\) failed \(err=-1\)",
):
setupterm(None, 0)