| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a3f43ba commit 50d2b21
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,8 +6,9 @@ | |||
| 6 | 6 | ||
| 7 | 7 | from curtsies.formatstringarray import FormatStringTest, fsarray | |
| 8 | 8 | from curtsies.fmtfuncs import cyan, bold, green, yellow, on_magenta, red | |
| 9 | - from bpython.curtsiesfrontend.events import RefreshRequestEvent | ||
| 10 | 9 | ||
| 10 | + from bpython.curtsiesfrontend.events import RefreshRequestEvent | ||
| 11 | + from bpython.test import mock | ||
| 11 | 12 | from bpython import config, inspection | |
| 12 | 13 | from bpython.curtsiesfrontend.repl import Repl | |
| 13 | 14 | from bpython.curtsiesfrontend import replpainter | |
@@ -23,7 +24,21 @@ def setup_config(): | |||
| 23 | 24 | return config_struct | |
| 24 | 25 | ||
| 25 | 26 | ||
| 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): | ||
| 27 | 42 | def setUp(self): | |
| 28 | 43 | self.repl = Repl(config=setup_config()) | |
| 29 | 44 | # clear history | |
@@ -42,13 +57,13 @@ def assert_paint_ignoring_formatting(self, screen, cursor_row_col=None): | |||
| 42 | 57 | self.assertEqual(cursor_pos, cursor_row_col) | |
| 43 | 58 | ||
| 44 | 59 | ||
| 45 | - class TestCurtsiesPaintingTest(TestCurtsiesPainting): | ||
| 60 | + class TestCurtsiesPaintingTest(CurtsiesPaintingTest): | ||
| 46 | 61 | ||
| 47 | 62 | def test_history_is_cleared(self): | |
| 48 | 63 | self.assertEqual(self.repl.rl_history.entries, ['']) | |
| 49 | 64 | ||
| 50 | 65 | ||
| 51 | - class TestCurtsiesPaintingSimple(TestCurtsiesPainting): | ||
| 66 | + class TestCurtsiesPaintingSimple(CurtsiesPaintingTest): | ||
| 52 | 67 | ||
| 53 | 68 | def test_startup(self): | |
| 54 | 69 | screen = fsarray([cyan('>>> '), cyan('Welcome to')]) | |
@@ -137,7 +152,7 @@ def output_to_repl(repl): | |||
| 137 | 152 | sys.stdout, sys.stderr = old_out, old_err | |
| 138 | 153 | ||
| 139 | 154 | ||
| 140 | - class TestCurtsiesRewindRedraw(TestCurtsiesPainting): | ||
| 155 | + class TestCurtsiesRewindRedraw(CurtsiesPaintingTest): | ||
| 141 | 156 | def refresh(self): | |
| 142 | 157 | self.refresh_requests.append(RefreshRequestEvent()) | |
| 143 | 158 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -221,6 +221,7 @@ def create_repl(**kwargs): | |||
| 221 | 221 | config = setup_config({'editor': 'true'}) | |
| 222 | 222 | repl = curtsiesrepl.Repl(config=config, **kwargs) | |
| 223 | 223 | os.environ['PAGER'] = 'true' | |
| 224 | + os.environ.pop('PYTHONSTARTUP', None) | ||
| 224 | 225 | repl.width = 50 | |
| 225 | 226 | repl.height = 20 | |
| 226 | 227 | return repl | |
| Back | FazBrowse Home | New Git URL |
0 commit comments