mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-23 00:29:59 +02:00
doc update and fix tests
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
jc changelog
|
jc changelog
|
||||||
|
|
||||||
20231002 v1.23.5
|
20231021 v1.23.5
|
||||||
- Add `host` command parser
|
- Add `host` command parser
|
||||||
- Add `nsd-control` command parser
|
- Add `nsd-control` command parser
|
||||||
- Add `lsb_release` command parser
|
- Add `lsb_release` command parser
|
||||||
@ -12,6 +12,7 @@ jc changelog
|
|||||||
- Fix `x509-cert` parser to allow negative serial numbers
|
- Fix `x509-cert` parser to allow negative serial numbers
|
||||||
- Fix `x509-cert` parser for cases when bitstrings are larger than standard
|
- Fix `x509-cert` parser for cases when bitstrings are larger than standard
|
||||||
- Fix `xrandr` command parser for associated device issues
|
- Fix `xrandr` command parser for associated device issues
|
||||||
|
- Fix error when pygments library is not installed
|
||||||
|
|
||||||
20230730 v1.23.4
|
20230730 v1.23.4
|
||||||
- Add `/etc/resolve.conf` file parser
|
- Add `/etc/resolve.conf` file parser
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
|
try:
|
||||||
import pygments
|
import pygments
|
||||||
from pygments.token import (Name, Number, String, Keyword)
|
from pygments.token import (Name, Number, String, Keyword)
|
||||||
|
PYGMENTS_INSTALLED=True
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
PYGMENTS_INSTALLED=False
|
||||||
from jc.cli import JcCli
|
from jc.cli import JcCli
|
||||||
|
|
||||||
|
|
||||||
@ -42,6 +46,7 @@ class MyTests(unittest.TestCase):
|
|||||||
self.assertEqual(expected, resulting_attributes)
|
self.assertEqual(expected, resulting_attributes)
|
||||||
|
|
||||||
def test_cli_set_env_colors(self):
|
def test_cli_set_env_colors(self):
|
||||||
|
if PYGMENTS_INSTALLED:
|
||||||
if pygments.__version__.startswith('2.3.'):
|
if pygments.__version__.startswith('2.3.'):
|
||||||
env = {
|
env = {
|
||||||
'': {
|
'': {
|
||||||
@ -140,6 +145,7 @@ class MyTests(unittest.TestCase):
|
|||||||
self.assertEqual(cli.custom_colors, expected_colors)
|
self.assertEqual(cli.custom_colors, expected_colors)
|
||||||
|
|
||||||
def test_cli_json_out(self):
|
def test_cli_json_out(self):
|
||||||
|
if PYGMENTS_INSTALLED:
|
||||||
test_input = [
|
test_input = [
|
||||||
None,
|
None,
|
||||||
{},
|
{},
|
||||||
@ -173,6 +179,7 @@ class MyTests(unittest.TestCase):
|
|||||||
self.assertEqual(cli.json_out(), expected_json)
|
self.assertEqual(cli.json_out(), expected_json)
|
||||||
|
|
||||||
def test_cli_json_out_mono(self):
|
def test_cli_json_out_mono(self):
|
||||||
|
if PYGMENTS_INSTALLED:
|
||||||
test_input = [
|
test_input = [
|
||||||
None,
|
None,
|
||||||
{},
|
{},
|
||||||
@ -221,6 +228,7 @@ class MyTests(unittest.TestCase):
|
|||||||
self.assertEqual(cli.json_out(), expected_json)
|
self.assertEqual(cli.json_out(), expected_json)
|
||||||
|
|
||||||
def test_cli_yaml_out(self):
|
def test_cli_yaml_out(self):
|
||||||
|
if PYGMENTS_INSTALLED:
|
||||||
test_input = [
|
test_input = [
|
||||||
None,
|
None,
|
||||||
{},
|
{},
|
||||||
|
Reference in New Issue
Block a user