diff options
author | Andrew Ammerlaan <andrewammerlaan@riseup.net> | 2020-01-15 09:45:23 +0100 |
---|---|---|
committer | Joonas Niilola <juippis@gentoo.org> | 2020-01-23 11:53:18 +0200 |
commit | 55553ee04ae97b8aabf8c061aff3c44be7cb8313 (patch) | |
tree | 27e01d792f1cca1bc0c3faa5b77fe053182bcb85 /dev-python/coloredlogs | |
parent | dev-python/verboselogs: Version bump 1.7 and add py3_7 (diff) | |
download | gentoo-55553ee04ae97b8aabf8c061aff3c44be7cb8313.tar.gz gentoo-55553ee04ae97b8aabf8c061aff3c44be7cb8313.tar.bz2 gentoo-55553ee04ae97b8aabf8c061aff3c44be7cb8313.zip |
dev-python/coloredlogs: Version bump 10.0 and add py3_7
Package-Manager: Portage-2.3.84, Repoman-2.3.20
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Closes: https://github.com/gentoo/gentoo/pull/14342
Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'dev-python/coloredlogs')
4 files changed, 157 insertions, 0 deletions
diff --git a/dev-python/coloredlogs/Manifest b/dev-python/coloredlogs/Manifest index ba1aee5cbbc2..004a6b8528b9 100644 --- a/dev-python/coloredlogs/Manifest +++ b/dev-python/coloredlogs/Manifest @@ -1 +1,2 @@ +DIST coloredlogs-10.0.tar.gz 273273 BLAKE2B 775b12718d780da396d74c7f960cdbbd4858c793bf3eefb53d29e9f6b415f682110ae2c7ac631be230578946a2fab8d75e0c3aa487ccd952bb05443f0a85700c SHA512 f4a51fd8fa92ea4e2ef0b58305dcc4bbe12851e722fc85cfd4f48a9388002efced52bcf027f6dc4c525b095f3f953970e73928fdce3245ab4f9d13ae36b9d498 DIST coloredlogs-6.1.tar.gz 28057 BLAKE2B bbb5946db3e6cbfae0b9947d2aa29769858833e35213a44a5be4ceb434021ee8c583ff00c980b9ab4fc533f6fec80e151895097b6a87c44257ef0fd5c7ab0bab SHA512 834cf993e7ffd3328644d334912fcf5a5156a441c6184643b38e5f356d46d7b5c48e02ee1e1b432265052c7a5ab1071ba456e575217a4a762f8387131059c405 diff --git a/dev-python/coloredlogs/coloredlogs-10.0.ebuild b/dev-python/coloredlogs/coloredlogs-10.0.ebuild new file mode 100644 index 000000000000..6c4a97d80c70 --- /dev/null +++ b/dev-python/coloredlogs/coloredlogs-10.0.ebuild @@ -0,0 +1,38 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{6,7,8} ) + +DISTUTILS_USE_SETUPTOOLS=rdepend + +inherit distutils-r1 + +DESCRIPTION="Colored stream handler for the logging module" +HOMEPAGE=" + https://pypi.org/project/coloredlogs/ + https://github.com/xolox/python-coloredlogs + https://coloredlogs.readthedocs.io/en/latest/" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux" + +RDEPEND="dev-python/humanfriendly[${PYTHON_USEDEP}]" + +DEPEND="test? ( + dev-python/capturer[${PYTHON_USEDEP}] + dev-python/coverage[${PYTHON_USEDEP}] + dev-python/mock[${PYTHON_USEDEP}] + dev-python/verboselogs[${PYTHON_USEDEP}] )" + +PATCHES="${FILESDIR}/${P}-skip-sandbox-violation-tests.patch" + +distutils_enable_sphinx docs +distutils_enable_tests pytest + +python_test() { + pytest -vv ${PN}/tests.py || die "Tests fail with ${EPYTHON}" +} diff --git a/dev-python/coloredlogs/files/coloredlogs-10.0-skip-cli-test.patch b/dev-python/coloredlogs/files/coloredlogs-10.0-skip-cli-test.patch new file mode 100644 index 000000000000..ba03612f7aeb --- /dev/null +++ b/dev-python/coloredlogs/files/coloredlogs-10.0-skip-cli-test.patch @@ -0,0 +1,17 @@ +diff --git a/coloredlogs/tests.py b/coloredlogs/tests.py +index 38f2d97..8d1ae36 100644 +--- a/coloredlogs/tests.py ++++ b/coloredlogs/tests.py +@@ -503,12 +503,6 @@ class ColoredLogsTestCase(TestCase): + for name in 'debug', 'info', 'warning', 'error', 'critical': + assert name.upper() in output + +- def test_cli_conversion(self): +- """Test the command line HTML conversion.""" +- output = main('coloredlogs', '--convert', 'coloredlogs', '--demo', capture=True) +- # Make sure the output is encoded as HTML. +- assert '<span' in output +- + def test_empty_conversion(self): + """ + Test that conversion of empty output produces no HTML. diff --git a/dev-python/coloredlogs/files/coloredlogs-10.0-skip-sandbox-violation-tests.patch b/dev-python/coloredlogs/files/coloredlogs-10.0-skip-sandbox-violation-tests.patch new file mode 100644 index 000000000000..dad047afd8d9 --- /dev/null +++ b/dev-python/coloredlogs/files/coloredlogs-10.0-skip-sandbox-violation-tests.patch @@ -0,0 +1,101 @@ +diff --git a/coloredlogs/tests.py b/coloredlogs/tests.py +index 38f2d97..c4353f1 100644 +--- a/coloredlogs/tests.py ++++ b/coloredlogs/tests.py +@@ -184,48 +184,6 @@ class ColoredLogsTestCase(TestCase): + # Make sure colored logging is disabled. + assert not isinstance(handler.formatter, ColoredFormatter) + +- def test_system_logging(self): +- """Make sure the :class:`coloredlogs.syslog.SystemLogging` context manager works.""" +- system_log_file = self.find_system_log() +- expected_message = random_string(50) +- with SystemLogging(programname='coloredlogs-test-suite') as syslog: +- if not syslog: +- return self.skipTest("couldn't connect to syslog daemon") +- # When I tried out the system logging support on macOS 10.13.1 on +- # 2018-01-05 I found that while WARNING and ERROR messages show up +- # in the system log DEBUG and INFO messages don't. This explains +- # the importance of the level of the log message below. +- logging.error("%s", expected_message) +- # Retry the following assertion (for up to 60 seconds) to give the +- # logging daemon time to write our log message to disk. This +- # appears to be needed on MacOS workers on Travis CI, see: +- # https://travis-ci.org/xolox/python-coloredlogs/jobs/325245853 +- retry(lambda: check_contents(system_log_file, expected_message, True)) +- +- def test_syslog_shortcut_simple(self): +- """Make sure that ``coloredlogs.install(syslog=True)`` works.""" +- system_log_file = self.find_system_log() +- expected_message = random_string(50) +- with cleanup_handlers(): +- # See test_system_logging() for the importance of this log level. +- coloredlogs.install(syslog=True) +- logging.error("%s", expected_message) +- # See the comments in test_system_logging() on why this is retried. +- retry(lambda: check_contents(system_log_file, expected_message, True)) +- +- def test_syslog_shortcut_enhanced(self): +- """Make sure that ``coloredlogs.install(syslog='warning')`` works.""" +- system_log_file = self.find_system_log() +- the_expected_message = random_string(50) +- not_an_expected_message = random_string(50) +- with cleanup_handlers(): +- # See test_system_logging() for the importance of these log levels. +- coloredlogs.install(syslog='error') +- logging.warning("%s", not_an_expected_message) +- logging.error("%s", the_expected_message) +- # See the comments in test_system_logging() on why this is retried. +- retry(lambda: check_contents(system_log_file, the_expected_message, True)) +- retry(lambda: check_contents(system_log_file, not_an_expected_message, False)) + + def test_name_normalization(self): + """Make sure :class:`~coloredlogs.NameNormalizer` works as intended.""" +@@ -369,34 +327,6 @@ class ColoredLogsTestCase(TestCase): + logging.info("This should be timestamped according to #45.") + assert re.match(r'^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}\+\d{4}\s', stream.getvalue()) + +- def test_plain_text_output_format(self): +- """Inspect the plain text output of coloredlogs.""" +- logger = VerboseLogger(random_string(25)) +- stream = StringIO() +- install(level=logging.NOTSET, logger=logger, stream=stream) +- # Test that filtering on severity works. +- logger.setLevel(logging.INFO) +- logger.debug("No one should see this message.") +- assert len(stream.getvalue().strip()) == 0 +- # Test that the default output format looks okay in plain text. +- logger.setLevel(logging.NOTSET) +- for method, severity in ((logger.debug, 'DEBUG'), +- (logger.info, 'INFO'), +- (logger.verbose, 'VERBOSE'), +- (logger.warning, 'WARNING'), +- (logger.error, 'ERROR'), +- (logger.critical, 'CRITICAL')): +- # Prepare the text. +- text = "This is a message with severity %r." % severity.lower() +- # Log the message with the given severity. +- method(text) +- # Get the line of output generated by the handler. +- output = stream.getvalue() +- lines = output.splitlines() +- last_line = lines[-1] +- assert text in last_line +- assert severity in last_line +- assert PLAIN_TEXT_PATTERN.match(last_line) + + def test_html_conversion(self): + """Check the conversion from ANSI escape sequences to HTML.""" +@@ -503,12 +433,6 @@ class ColoredLogsTestCase(TestCase): + for name in 'debug', 'info', 'warning', 'error', 'critical': + assert name.upper() in output + +- def test_cli_conversion(self): +- """Test the command line HTML conversion.""" +- output = main('coloredlogs', '--convert', 'coloredlogs', '--demo', capture=True) +- # Make sure the output is encoded as HTML. +- assert '<span' in output +- + def test_empty_conversion(self): + """ + Test that conversion of empty output produces no HTML. |