14
0

Accepting request 700393 from home:mcepl:branches:devel:languages:python

- Add test_cli_conversion_test.patch, because we don't have versionless
  coloredlogs in time of %check.

OBS-URL: https://build.opensuse.org/request/show/700393
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-coloredlogs?expand=0&rev=10
This commit is contained in:
2019-05-03 14:13:00 +00:00
committed by Git OBS Bridge
parent 6415e61222
commit 57ee7a9eb9
3 changed files with 37 additions and 2 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri May 3 14:04:05 UTC 2019 - Matej Cepl <mcepl@suse.com>
- Add test_cli_conversion_test.patch, because we don't have versionless
coloredlogs in time of %check.
-------------------------------------------------------------------
Thu Feb 14 15:16:19 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>

View File

@@ -26,6 +26,9 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/xolox/python-coloredlogs
Source: https://files.pythonhosted.org/packages/source/c/coloredlogs/coloredlogs-%{version}.tar.gz
# PATCH-FIX-OPENSUSE test_cli_conversion_test.patch mcepl@suse.com
# With using alternatives, we don't have versionless command in time of %check
Patch0: test_cli_conversion_test.patch
BuildRequires: %{python_module capturer >= 2.4}
BuildRequires: %{python_module humanfriendly >= 3.2}
BuildRequires: %{python_module mock >= 1.0.1}
@@ -54,6 +57,7 @@ using Colorama.
%prep
%setup -q -n coloredlogs-%{version}
%autopatch -p1
%build
%python_build
@@ -70,10 +74,10 @@ using Colorama.
%python_uninstall_alternative coloredlogs
%check
# test_cli_conversion - requires coloredlogs binary available, we don't have it at this point
# test_auto_install - requires the install to the system to be actually complete
# test_plain_text_output_format - random hickupy test
%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_version} coloredlogs/tests.py -v -k 'not (test_cli_conversion or test_auto_install or test_plain_text_output_format)'
export PATH=%{buildroot}%{_bindir}:$PATH
%pytest coloredlogs/tests.py -k 'not (test_auto_install or test_plain_text_output_format)'
%files %{python_files}
%doc README.rst CHANGELOG.rst

View File

@@ -0,0 +1,25 @@
--- a/coloredlogs/tests.py
+++ b/coloredlogs/tests.py
@@ -82,6 +82,7 @@ PATTERN_INCLUDING_MILLISECONDS = re.comp
\s (?P<message> .* )
''', re.VERBOSE)
+pyver = '.'.join(str(x) for x in sys.version_info[:2])
def setUpModule():
"""Speed up the tests by disabling the demo's artificial delay."""
@@ -505,7 +506,8 @@ class ColoredLogsTestCase(TestCase):
def test_cli_conversion(self):
"""Test the command line HTML conversion."""
- output = main('coloredlogs', '--convert', 'coloredlogs', '--demo', capture=True)
+ output = main('coloredlogs-{}'.format(pyver), '--convert',
+ 'coloredlogs-{}'.format(pyver), '--demo', capture=True)
# Make sure the output is encoded as HTML.
assert '<span' in output
@@ -588,3 +590,4 @@ def cleanup_handlers():
handler, logger = find_handler(logging.getLogger(), match_func)
if handler and logger:
logger.removeHandler(handler)
+