Skip to content

Commit 4cb4e77

Browse files
Fix tests
1 parent 4e5db7c commit 4cb4e77

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

bpython/test/test_interpreter.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import unicode_literals
44

5-
import linecache
65
import sys
76

87
from curtsies.fmtfuncs import bold, green, magenta, cyan, red, plain
@@ -14,12 +13,6 @@
1413
pypy = 'PyPy' in sys.version
1514

1615

17-
def _last_console_filename():
18-
"""Returns the last 'filename' used for console input
19-
(as will be displayed in a traceback)."""
20-
return '<bpython-input-%s>' % (len(linecache.cache.bpython_history) - 1)
21-
22-
2316
class TestInterpreter(unittest.TestCase):
2417
def test_syntaxerror(self):
2518
i = interpreter.Interp()
@@ -33,13 +26,13 @@ def append_to_a(message):
3326

3427
if pypy:
3528
expected = (
36-
' File ' + green('"%s"' % _last_console_filename()) +
29+
' File ' + green('"<input>"') +
3730
', line ' + bold(magenta('1')) + '\n 1.1.1.1\n ^\n' +
3831
bold(red('SyntaxError')) + ': ' + cyan('invalid syntax') +
3932
'\n')
4033
else:
4134
expected = (
42-
' File ' + green('"%s"' % _last_console_filename()) +
35+
' File ' + green('"<input>"') +
4336
', line ' + bold(magenta('1')) + '\n 1.1.1.1\n ^\n' +
4437
bold(red('SyntaxError')) + ': ' + cyan('invalid syntax') +
4538
'\n')
@@ -62,7 +55,7 @@ def f():
6255
def g():
6356
return f()
6457

65-
i.runsource('g()', encode=False)
58+
i.runsource('g()')
6659

6760
if pypy:
6861
global_not_found = "global name 'g' is not defined"
@@ -71,7 +64,7 @@ def g():
7164

7265
expected = (
7366
'Traceback (most recent call last):\n File ' +
74-
green('"%s"' % _last_console_filename()) + ', line ' +
67+
green('"<input>"') + ', line ' +
7568
bold(magenta('1')) + ', in ' + cyan('<module>') + '\n g()\n' +
7669
bold(red('NameError')) + ': ' + cyan(global_not_found) + '\n')
7770

0 commit comments

Comments
 (0)