Skip to content

Commit

Permalink
Merge branch 'jupyter:main' into HighlightTracebacks
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbautista authored Aug 6, 2024
2 parents cf7ad25 + d592079 commit 7de610f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions qtconsole/ansi_code_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AnsiCodeProcessor(object):

# Whether to increase intensity or set boldness for SGR code 1.
# (Different terminals handle this in different ways.)
bold_text_enabled = False
bold_text_enabled = True

# We provide an empty default color map because subclasses will likely want
# to use a custom color format.
Expand Down Expand Up @@ -327,7 +327,7 @@ class QtAnsiCodeProcessor(AnsiCodeProcessor):
0 : 'black', # black
1 : 'darkred', # red
2 : 'darkgreen', # green
3 : 'brown', # yellow
3 : 'gold', # yellow
4 : 'darkblue', # blue
5 : 'darkviolet', # magenta
6 : 'steelblue', # cyan
Expand Down
12 changes: 9 additions & 3 deletions qtconsole/tests/test_ansi_code_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
import unittest

# Local imports
from qtconsole.ansi_code_processor import AnsiCodeProcessor
from qtconsole.ansi_code_processor import AnsiCodeProcessor, QtAnsiCodeProcessor


class TestAnsiCodeProcessor(unittest.TestCase):

def setUp(self):
self.processor = AnsiCodeProcessor()
self.qt_processor = QtAnsiCodeProcessor()

def test_clear(self):
""" Do control sequences for clearing the console work?
Expand Down Expand Up @@ -37,7 +38,7 @@ def test_clear(self):
def test_colors(self):
""" Do basic controls sequences for colors work?
"""
string = 'first\x1b[34mblue\x1b[0mlast'
string = 'first\x1b[34mblue\x1b[0mlast\033[33mYellow'
i = -1
for i, substring in enumerate(self.processor.split_string(string)):
if i == 0:
Expand All @@ -49,9 +50,14 @@ def test_colors(self):
elif i == 2:
self.assertEqual(substring, 'last')
self.assertEqual(self.processor.foreground_color, None)
elif i == 3:
foreground_color = self.processor.foreground_color
self.assertEqual(substring, 'Yellow')
self.assertEqual(foreground_color, 3)
self.assertEqual(self.qt_processor.get_color(foreground_color).name(), '#ffd700')
else:
self.fail('Too many substrings.')
self.assertEqual(i, 2, 'Too few substrings.')
self.assertEqual(i, 3, 'Too few substrings.')

def test_colors_xterm(self):
""" Do xterm-specific control sequences for colors work?
Expand Down
4 changes: 4 additions & 0 deletions qtconsole/tests/test_comms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import time
from queue import Empty
import unittest
Expand All @@ -11,6 +12,9 @@ class Tests(unittest.TestCase):

def setUp(self):
"""Open a kernel."""
# Prevent tests assertions related with message type from failing
# due to a debug warning
os.environ['PYDEVD_DISABLE_FILE_VALIDATION'] = '1'
self.kernel_manager = QtKernelManager()
self.kernel_manager.start_kernel()
self.kernel_client = self.kernel_manager.client()
Expand Down
1 change: 0 additions & 1 deletion requirements/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ dependencies:
- jupyter_client
- pygments
- ipykernel
- pyzmq >=17.1

# For testing
- coveralls
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
'pygments',
'ipykernel>=4.1', # not a real dependency, but require the reference kernel
'qtpy>=2.4.0',
'pyzmq>=17.1',
'packaging'
],
extras_require = {
Expand Down

0 comments on commit 7de610f

Please sign in to comment.