66
77from curtsies .formatstringarray import FormatStringTest , fsarray
88from curtsies .fmtfuncs import cyan , bold , green , yellow , on_magenta , red
9- from bpython .curtsiesfrontend .events import RefreshRequestEvent
109
10+ from bpython .curtsiesfrontend .events import RefreshRequestEvent
11+ from bpython .test import mock
1112from bpython import config , inspection
1213from bpython .curtsiesfrontend .repl import Repl
1314from bpython .curtsiesfrontend import replpainter
@@ -23,7 +24,21 @@ def setup_config():
2324 return config_struct
2425
2526
26- class TestCurtsiesPainting (FormatStringTest , TestCase ):
27+ class ClearEnviron (TestCase ):
28+
29+ @classmethod
30+ def setUpClass (cls ):
31+ cls .mock_environ = mock .patch .dict ('os.environ' , {}, clear = True )
32+ cls .mock_environ .start ()
33+ TestCase .setUpClass ()
34+
35+ @classmethod
36+ def tearDownClass (cls ):
37+ cls .mock_environ .stop ()
38+ TestCase .tearDownClass ()
39+
40+
41+ class CurtsiesPaintingTest (FormatStringTest , ClearEnviron ):
2742 def setUp (self ):
2843 self .repl = Repl (config = setup_config ())
2944 # clear history
@@ -42,13 +57,13 @@ def assert_paint_ignoring_formatting(self, screen, cursor_row_col=None):
4257 self .assertEqual (cursor_pos , cursor_row_col )
4358
4459
45- class TestCurtsiesPaintingTest (TestCurtsiesPainting ):
60+ class TestCurtsiesPaintingTest (CurtsiesPaintingTest ):
4661
4762 def test_history_is_cleared (self ):
4863 self .assertEqual (self .repl .rl_history .entries , ['' ])
4964
5065
51- class TestCurtsiesPaintingSimple (TestCurtsiesPainting ):
66+ class TestCurtsiesPaintingSimple (CurtsiesPaintingTest ):
5267
5368 def test_startup (self ):
5469 screen = fsarray ([cyan ('>>> ' ), cyan ('Welcome to' )])
@@ -137,7 +152,7 @@ def output_to_repl(repl):
137152 sys .stdout , sys .stderr = old_out , old_err
138153
139154
140- class TestCurtsiesRewindRedraw (TestCurtsiesPainting ):
155+ class TestCurtsiesRewindRedraw (CurtsiesPaintingTest ):
141156 def refresh (self ):
142157 self .refresh_requests .append (RefreshRequestEvent ())
143158
0 commit comments