File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 1919# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2020
2121
22- from ._minimal_curses import error , setupterm , tigetstr , tparm
22+ try :
23+ import _curses
24+ except ImportError :
25+ try :
26+ import curses as _curses # type: ignore[no-redef]
27+ except ImportError :
28+ from . import _minimal_curses as _curses # type: ignore[no-redef]
29+
30+ setupterm = _curses .setupterm
31+ tigetstr = _curses .tigetstr
32+ tparm = _curses .tparm
33+ error = _curses .error
Original file line number Diff line number Diff line change 22
33import pytest
44
5- import pyrepl
6- from pyrepl .curses import setupterm
5+ from pyrepl ._minimal_curses import error , setupterm
76
87
9- def test_setupterm (monkeypatch ):
8+ @pytest .mark .xfail (sys .platform == "win32" , reason = "windows does not have _curses" )
9+ def test_imports ():
10+ import _curses
11+
12+ from pyrepl .curses import error , setupterm , tigetstr , tparm
13+
14+ assert setupterm is _curses .setupterm
15+ assert tigetstr is _curses .tigetstr
16+ assert tparm is _curses .tparm
17+ assert error is _curses .error
18+
19+
20+ def test_minimal_curses_setupterm (monkeypatch ):
1021 assert setupterm (None , 0 ) is None
1122
1223 exit_code = - 1 if sys .platform == "darwin" else 0
1324 with pytest .raises (
14- pyrepl . _minimal_curses . error ,
25+ error ,
1526 match = rf"setupterm\(b?'term_does_not_exist', 0\) failed \(err={ exit_code } \)" ,
1627 ):
1728 setupterm ("term_does_not_exist" , 0 )
@@ -21,7 +32,7 @@ def test_setupterm(monkeypatch):
2132
2233 monkeypatch .delenv ("TERM" )
2334 with pytest .raises (
24- pyrepl . _minimal_curses . error ,
35+ error ,
2536 match = r"setupterm\(None, 0\) failed \(err=-1\)" ,
2637 ):
2738 setupterm (None , 0 )
You can’t perform that action at this time.
0 commit comments